Skip to content

Rust regex doesn't respect EcmaScript regex invalid pattern #97

@edgul

Description

@edgul

The following test shows that this invalid regex input is being successfully parsed by Rust's Regex crate, but according to URLPattern spec it should fail.

 #[test]
  fn test_test() {
    let input = "((?R))"; // invalid in EcmaScript regex
    let _ = <UrlPattern>::parse(
      UrlPatternInit {
        protocol: Some(input.to_string()),
        ..Default::default()
      },
      Default::default(),
    )
    .unwrap();
  }

This currently passes because the following fragment passes:

    let input = "((?R))";
    let regexp = regex::Regex::new(input);
    regexp.unwrap();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions