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

XRegExp fails under Rhino #46

Closed
jaquet9 opened this issue Feb 19, 2013 · 2 comments
Closed

XRegExp fails under Rhino #46

jaquet9 opened this issue Feb 19, 2013 · 2 comments

Comments

@jaquet9
Copy link

jaquet9 commented Feb 19, 2013

I am trying to use XRegExp 3.0.0-pre with Rhino 1.6r2 (which is the version of Rhino shipping with Java 6).

Compiling the regex below (taken from http://xregexp.com/ ):

date = XRegExp('(?<year>  [0-9]{4} ) -?  # year  \n' +
               '(?<month> [0-9]{2} ) -?  # month \n' +
               '(?<day>   [0-9]{2} )     # day     ', 'x');

triggers the following error message:

"Invalid quantifier ?" at script line 517 (which is the line: "return augment(new RegExp(key.pattern, key.flags), key.captures, /*addProto*/ true);")

Inspecting key.pattern reveals that the ?<...> are not being stripped out:

(?<year>(?:)[0-9]{4}(?:))(?:)-?(?:)year(?:)(?<month>(?:)[0-9]{2}(?:))(?:)-?(?:)month(?:)(?<day>(?:)[0-9]{2}(?:))(?:)day

Does anyone have a workaround?

@slevithan
Copy link
Owner

@jaquet9, sorry for the long delay. Is it possible to verify whether this is still occurring with the finalized version of XRegExp 3.0.0 and the latest Rhino (currently Rhino 1.7.6)? Thanks!

@slevithan
Copy link
Owner

Will reopen if anyone is able to verify whether this is still failing in Rhino.

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