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 ES6 /u flag #4

Open
mathiasbynens opened this issue Oct 22, 2013 · 4 comments
Open

Support ES6 /u flag #4

mathiasbynens opened this issue Oct 22, 2013 · 4 comments

Comments

@mathiasbynens
Copy link
Collaborator

The /u flag should enable a special parsing mode in which astral ranges can be used, and surrogate pairs only count as a single symbol (i.e. get matched by .).

See the example here, for example: http://mathiasbynens.be/notes/javascript-unicode#astral-ranges Currently regexp.js fails to parse the regular expression with the emoji ranges because ES5 doesn’t support it. But with the /u flag, ES6 will! Here’s a link to the demo page with the example prefilled: http://jviereck.github.io/regexp.js/#regexp=%5B%F0%9F%92%A9-%F0%9F%92%AB%5D&input=%F0%9F%92%AA

More info on the /u flag: http://norbertlindenberg.com/2012/05/ecmascript-supplementary-characters/#RegExp

@jviereck
Copy link
Owner

Sounds interesting. Thanks a lot for bringing this up! However, this is nothing I plan to work on in the near future but PullRequests are always welcome. If assistance with the code base on how to maybe implement this is required, please reach out to me at any time.

@mathiasbynens
Copy link
Collaborator Author

In order to implement the u flag, the parser would need to be aware of the flags, as different parsing rules apply in that case.

@jviereck Any plans to release the parser as a separate npm package (and simply using it as a dependency for regexp.js)?

@jviereck
Copy link
Owner

Not until now, but sounds good to me. Will take some days until I get to it - feel free to ping me if I forget about it.

@mathiasbynens
Copy link
Collaborator Author

Ping! :) I’ve filed it as a separate issue so it’s easier to keep track of: #6

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

2 participants