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

some case wrong #6

Open
xinshangshangxin opened this issue Apr 9, 2018 · 4 comments
Open

some case wrong #6

xinshangshangxin opened this issue Apr 9, 2018 · 4 comments

Comments

@xinshangshangxin
Copy link

xinshangshangxin commented Apr 9, 2018

like next line RegExp, which with repeat symbol ( + or * ), it will be wrong
/(ba)+.(a*)/

regexp.execForAllGroups('bababaaaaa', true);
matches:  [ { match: 'ba', start: 0, end: 2 },
  { match: 'aaa', start: 3, end: 6 } ]

I think the regexp should change to /((ba)+).(a*)/ when calculate the next match position

@valoricDe
Copy link
Owner

Hi @xinshangshangxin thank you for your feedback. I always have to dive in again into the logic. I will have a look at it tonight. If you have any suggestions aka pull request I'll happily have a look at it.

@mafar
Copy link

mafar commented Mar 5, 2019

image
Pasting code on jsfiddle gives error

@valoricDe
Copy link
Owner

@mafar
1st. Create a separate ticket
2nd Do you mind posting the url to the jsfiddle.
3rd use npm install multi-regexp2 or the files from dist when not using ES6 compatible environment

@valoricDe
Copy link
Owner

valoricDe commented Dec 8, 2019

Hey @xinshangshangxin I never got back to you. (ba)+ is really tricky. it just catches the last occurence of ba. So if I add the capturing group it would have three matching groups altough you only specified two. But on the other hand all developers probably want to know the hole group when they right something like this.

@valoricDe valoricDe reopened this Dec 8, 2019
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

3 participants