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

Regex fails on RN #231

Closed
sourabhv opened this issue Apr 29, 2020 · 6 comments
Closed

Regex fails on RN #231

sourabhv opened this issue Apr 29, 2020 · 6 comments

Comments

@sourabhv
Copy link

The RegEx /^{+\/?|\/?}+$/ fails on RN 0.61.5 with error

Invalid regular expression: Quantifier has nothing to repeat, js engine: hermes

But the regex works fine on hermes build from master.

Changing the regex to /^\{+\/?|\/?\}+$/ also works.

@avp
Copy link
Contributor

avp commented Apr 29, 2020

RN 0.61.5 is a release from November 2019. The Hermes regex parser bug was likely fixed in the series of commits near edeef8a, which is why updating Hermes and RN should fix your issue.

Closing because the fix is already in master.

@avp avp closed this as completed Apr 29, 2020
@roots-ai
Copy link

roots-ai commented Oct 8, 2021

Still facing the issue on RN 0.66.0 and Hermes 0.9.0

@avp
Copy link
Contributor

avp commented Oct 8, 2021

@roots-ai I just tested the regex given in the issue and it works in Hermes 0.9.0, which I downloaded from the releases page.

@Abrax20
Copy link

Abrax20 commented Oct 25, 2021

@avp I have the same issue on the new hermes version with [email protected].

I tested the regex /^[a-zA-Z0-9+/]+(?<padding>={0,2})$/ in the hermes playground

@avp
Copy link
Contributor

avp commented Oct 25, 2021

@Abrax20 looks like that uses a named capture group, which isn't a supported feature of the Hermes RegExp engine yet.

You can check https://github.com/facebook/hermes/blob/main/doc/RegExp.md for more information on which RegExp features Hermes supports right now.

@Abrax20
Copy link

Abrax20 commented Oct 26, 2021

@avp Thanks your response :)!
I fixed the issue using a RegExp transform babel plugin. @roots-ai If you need a fix for the issue, please install babel-plugin-transform-modern-regexp.

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

4 participants