Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid Regex Flag x #163

Open
yishayw opened this issue Oct 27, 2020 · 3 comments
Open

Invalid Regex Flag x #163

yishayw opened this issue Oct 27, 2020 · 3 comments

Comments

@yishayw
Copy link
Contributor

yishayw commented Oct 27, 2020

  •                           var regex : RegExp = /[\s*]+/gx;
    
  •                           var regex : RegExp = /[\s*]+/g;
    

The x flag is legal in AS3 but not in js, so the first line should probably yield be a compile time error.

@Harbs
Copy link
Contributor

Harbs commented Oct 27, 2020

I thought I remember the x is rewritten?

@yishayw
Copy link
Contributor Author

yishayw commented Oct 27, 2020

Not in what I saw... I'll try to come up with a test case when I find the time.

@estanglerbm
Copy link
Contributor

new RegExp("a | b", "gx")

produces this runtime error:

Uncaught SyntaxError: invalid regular expression flag x

The x is extended syntax, to allow spaces to be in the expression for readability purposes. The spaces are ignored, unless preceded by a backslash (\).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants