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

RegGrp messes up non-capturing matches #13

Closed
GoogleCodeExporter opened this issue Dec 6, 2015 · 5 comments
Closed

RegGrp messes up non-capturing matches #13

GoogleCodeExporter opened this issue Dec 6, 2015 · 5 comments

Comments

@GoogleCodeExporter
Copy link

When using RegGrp with non-capturing matches /(?:red\s+)/, the replacements
after the non-captured submatch get mixed up. See testcase.

Original issue reported on code.google.com by doek...@gmail.com on 9 Jun 2007 at 8:33

@GoogleCodeExporter
Copy link
Author

Oops, forgot to attach the test-case.

Original comment by doek...@gmail.com on 9 Jun 2007 at 8:36

Attachments:

@GoogleCodeExporter
Copy link
Author

Defect solved in subversion. /lib/ is not updated, however.

Original comment by doek...@gmail.com on 9 Jun 2007 at 8:39

  • Changed state: Fixed

@GoogleCodeExporter
Copy link
Author

Original comment by doek...@gmail.com on 14 Jul 2007 at 7:07

  • Added labels: Browser-All, Module-base2

@GoogleCodeExporter
Copy link
Author

I'm re-opening this bug. The referenced source module is RegGrp/Item.js. The
checked-in solution has two failings:

1. the RegExp /\((?!\?)/ does not compile on IE5.0
2. the RegExp /\((?!\?)/ does not match sub-queries correctly:
   e.g. var number = /\b[+-]?(\d*\.?\d+|\d+\.?\d*)([eE][+-]?\d+)?\b/;
        new RegGrp.Item(number, "").length; // => 1 (should be 2)

Original comment by dean.edw...@gmail.com on 15 Jul 2007 at 11:28

  • Changed state: Re-open

@GoogleCodeExporter
Copy link
Author

Fixed the issue with a basic RegExp, so IE5 should be OK.
The number now also has a length of 2.

BTW: What's wrong with a JSON number: /^\-?(0|[1-9]\d*)(\.\d+)?([eE][-+]?\d+)?$/

Original comment by doek...@gmail.com on 16 Jul 2007 at 6:21

  • Changed state: Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant