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

Document inability to match lone low surrogates accurately #17

Closed
mathiasbynens opened this issue Jan 30, 2015 · 0 comments
Closed

Document inability to match lone low surrogates accurately #17

mathiasbynens opened this issue Jan 30, 2015 · 0 comments

Comments

@mathiasbynens
Copy link
Owner

var regex = /^a[\u{D800}-\u{DBFF}\u{DC00}-\u{DFFF}]b$/u;
console.log(
  regex.test('a\uD800b'),
  regex.test('a\uDC00b')
);

Expected: true, true
Actual: true, false

https://mothereff.in/regexpu#var%20regex%20%3D%20%2F%5Ea%5B%5Cu%7BD800%7D-%5Cu%7BDBFF%7D%5Cu%7BDC00%7D-%5Cu%7BDFFF%7D%5Db%24%2Fu%3B%0Aconsole.log%28%0A%20%20regex.test%28%27a%5CuD800b%27%29%2C%0A%20%20regex.test%28%27a%5CuDC00b%27%29%0A%29%3B

Ref. mathiasbynens/regenerate#28 (comment).
https://esdiscuss.org/topic/q-lonely-surrogates-and-unicode-regexps#content-3

@mathiasbynens mathiasbynens changed the title Document inability to match lone surrogates accurately Document inability to match lone low surrogates accurately Feb 2, 2015
mathiasbynens added a commit to mathiasbynens/regenerate that referenced this issue Feb 2, 2015
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

1 participant