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

Support for back-references #4

Closed
anba opened this issue Aug 26, 2014 · 1 comment
Closed

Support for back-references #4

anba opened this issue Aug 26, 2014 · 1 comment
Labels

Comments

@anba
Copy link

anba commented Aug 26, 2014

/(s)\1/ui is currently transformed to /([s\u017F])\x01/i.

  1. Back references should probably not be transformed to hexadecimal escapes
  2. Canonicalizing the back reference's content is tricky, I'm not sure how this feature can be supported without canonicalizing the input string first, e.g. in /(s)\1/ui.test("s\u017f") == true.
@mathiasbynens
Copy link
Owner

Good catch – thanks!

(1) is a bug in regjsparser, which regexpu depends on. I’ve reported it and and will try to get it fixed as soon as possible.

As for (2), I’d rather not transpile strings too (especially since it could only ever work reliably for literals). I’ve managed to avoid this for /iu regular expressions without back-references. I’m afraid you’re right that it cannot be done in these cases, though. :(

Once (1) is resolved, I’ll add a note to the README saying regexpu doesn’t support canonicalizing the contents of back-references in regular expressions with both the i and u flag set, since that would require transpiling/wrapping strings.

@mathiasbynens mathiasbynens changed the title Support for back references Support for back-references Sep 1, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants