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 causes "Quantifier has nothing to repeat" #46

Closed
Kikketer opened this issue Jul 17, 2019 · 8 comments
Closed

Regex causes "Quantifier has nothing to repeat" #46

Kikketer opened this issue Jul 17, 2019 · 8 comments

Comments

@Kikketer
Copy link

Kikketer commented Jul 17, 2019

I've tested this against the non-hermes version and it works fine. It seems that when I attempt to use my regex string it crashes the app:

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

I have an example application here: https://github.com/Kikketer/HermesRejex/blob/master/App.js#L22

It's very simple in the fact that it attempts to run a rejex against a string when you tap the "Hi There" text.

The simple app is right out of the react-native init except that it has hermes enabled and this new tap functionality.

Also since reading regex can be painful, the string this matches would be:

{{date(2019-07-17T14:57:33.780Z, short)}}
@Kikketer Kikketer changed the title Rejex causes "Quantifier has nothing to repeat" Regex causes "Quantifier has nothing to repeat" Jul 17, 2019
@Kikketer
Copy link
Author

I've discovered the issue, I needed to add some "seemingly useless" escapes. Just a challenge with different regex parsers:

/{{2}/

turned to:

/\{{2}/

Fixes the issue. Just something to note for any other developer out there that has some regex and it's only failing on Hermes.

@fonov
Copy link

fonov commented Mar 15, 2020

For me, i encountered an error when use named capturing group in regex

(?<Name>x)

@avp
Copy link
Contributor

avp commented Mar 15, 2020

Hermes does not yet support named capture groups in RegExp. We're adding newer JS features incrementally and named capture groups will be implemented in the future. Unfortunately, priority for this particular feature is low because we have other features to implement first, but we're open to working with the community on pull requests to add it.

You can see more information about RegExp support here:
https://github.com/facebook/hermes/blob/master/doc/RegExp.md

facebook-github-bot pushed a commit that referenced this issue Feb 21, 2021
Summary:
Added a *much shorter* set of instructions to integrate with
the build plugin 4.0.

Pull Request resolved: facebookincubator/fbjni#46

Test Plan: _eyes

Reviewed By: fabiomassimo

Differential Revision: D26545014

Pulled By: passy

fbshipit-source-id: 67f111e60fc193d75351b70976abb452e33bf943
ehsan6sha added a commit to functionland/fx-fotos that referenced this issue Aug 12, 2021
mganandraj added a commit to mganandraj/hermes that referenced this issue Nov 29, 2021
* Adding react-native-windows-write as the code owner

* Adding jshost also as the code owner
@hanancs
Copy link

hanancs commented Jan 6, 2022

For me, i encountered an error when use named capturing group in regex

(?<Name>x)

How did you solve it?

@fonov
Copy link

fonov commented Jan 6, 2022

For me, i encountered an error when use named capturing group in regex
(?<Name>x)

How did you solve it?

just use didn't use named capturing group because it doesn't have native support in hermes. Maybe in fresh version of hermes was implemented, I didn't check it.

@juananime
Copy link

If any one still running this issue despite solutions mention above, I could sort it out adding he @babel/preset-env to the dev dependencies, apparently, that babel has de plugin that fixes this reg exp issue

@samzmann
Copy link

samzmann commented Mar 9, 2022

@juananime I tried adding @babel/preset-env, rebuild, restart packager, etc. but still same issue. Can you plz give a little more details about what you did to get your regex working?

gburgett added a commit to watermarkchurch/contentful-local-schema that referenced this issue Mar 25, 2022
@visitsb
Copy link

visitsb commented Sep 14, 2022

what @juananime means is this

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

7 participants