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 regex named capture groups #89

Closed
Sam-Martin opened this issue Aug 17, 2019 · 4 comments
Closed

Support regex named capture groups #89

Sam-Martin opened this issue Aug 17, 2019 · 4 comments

Comments

@Sam-Martin
Copy link

Sam-Martin commented Aug 17, 2019

It looks like the regex parser doesn't currently support named capture groups.
If you specify one, e.g.

regex = new RegExp('(?<contextBefore>.*)', 'ig')

it will throw a SyntaxError: Invalid RegExp patterm: Quantifier has nothing to repeat, js engine: hermes
Is this intentional, or a bug?

@mhorowitz
Copy link
Contributor

mhorowitz commented Aug 23, 2019

It's intentional. The list of features we target today is based on ES6 (the 2015 edition of the language specification): https://github.com/facebook/hermes/blob/master/doc/Features.md

Named capture groups were added in the 2018 edition. We expect to support newer versions of the spec, including this feature, in the future, but we don't have a roadmap for this yet. We would be happy see PRs to add support for newer features which people are interested in.

@aprilmintacpineda
Copy link

I just ran into this problem facebook/react-native#32453 but it's because of ansi-styles, any possible work arounds?

@bombillazo
Copy link

bombillazo commented Mar 11, 2022

Hello, could this feature be considered for the hermes roadmap?

As more dependencies and libraries start incorporating named capture groups into their code, hermes will crash whenever it finds one of those deps. It is already occurring as discussed in chalk/ansi-styles#78 and chalk/ansi-styles#80.

Thanks.

@BBKolton
Copy link

BBKolton commented Jun 1, 2022

I just ran into this problem facebook/react-native#32453 but it's because of ansi-styles, any possible work arounds?

I ran into this issue as well. If you're ending up here, facebook/react-native#32453 (comment) solved my problem. It would still be great if Hermes could support capture groups to the ES spec. Thanks!

mganandraj pushed a commit to mganandraj/hermes that referenced this issue Jun 22, 2022
We produce proper debug binaries for debug builds now, so this wrapper is no longer necessary.

This also addresses the issue where strings with embedded NUL characters would be truncated (due to the use of c_str instead of data/size).
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

5 participants