Skip to content

False-positive that produces invalid regular expression #66

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

Open
EvgenyOrekhov opened this issue Jul 19, 2020 · 4 comments
Open

False-positive that produces invalid regular expression #66

EvgenyOrekhov opened this issue Jul 19, 2020 · 4 comments

Comments

@EvgenyOrekhov
Copy link

/\]/u is getting optimized to /]/u which produces Parsing error: Invalid regular expression: /]/: Lone quantifier brackets.

@kasugaiasuka
Copy link

Same issue, /\{.*\}/u.exec("abc{foo}xyz") is optimized to /{.*}/u.exec("abc{foo}xyz") which produces Uncaught SyntaxError: Invalid regular expression: /{.*}/: Lone quantifier brackets.

The u flag disables Annex B extension, and makes regex behave like strict mode.
I noticed this problem because require-unicode-regexp recommended u to me.

@BrainMaestro
Copy link
Owner

Please report this issue to the upstream library https://github.com/DmitrySoshnikov/regexp-tree

@EvgenyOrekhov
Copy link
Author

Upstream issue: DmitrySoshnikov/regexp-tree#224.

@BrainMaestro
Copy link
Owner

Great! Once it's fixed, I will be happy to publish an update that includes the fix

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