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

nested groups do not work #10

Open
mafar opened this issue Mar 8, 2019 · 5 comments
Open

nested groups do not work #10

mafar opened this issue Mar 8, 2019 · 5 comments

Comments

@mafar
Copy link

mafar commented Mar 8, 2019

regex101:
https://regex101.com/r/Whivxv/1

JSFIDDLE: (with MultiRegExp2 usage for same test case)
https://jsfiddle.net/bababalcksheep/o104bcq6/18/

image

should return 2 matches , each macth has 1 full match and 2 gruops

@mafar
Copy link
Author

mafar commented Mar 8, 2019

  1. I think yo uare not using flags . If you turn off global flag @ https://regex101.com/r/Whivxv/1 then result is same as MultiRegExp2
  2. How can i pass flags to new MultiRegExp2(string, flags) like vanilla js new RegExp(string,flags);
  3. Do the flags get consumed automatically fora given string ? like var string = "/abc/ig"

@mafar
Copy link
Author

mafar commented Mar 8, 2019

I will propsoe function renaming as well since from https://regex101.com and possibility if mutipule matches ,

  1. A regex can have more than one matches
  2. Each match can have a fullMatch (result_array 0) and more than one groups (result_array 0+n)

execForAllGroups(string: string, includeFullMatch: boolean)
renamed to execAll(string: string)
I dont see why , includeFullMatch: booleanwould be needed in this case
this way if global flagwas used then for more than one matches user can loop through matches
If there was no global flag, user can just use array (0) which is first Match , or he can still loop through it but it will have one result anyway

@mafar
Copy link
Author

mafar commented Mar 8, 2019

execForGroup(string: string, group: Number)
can be renamed to
execForMatchGroup(string: string, match: Number, group: Number)

@mafar
Copy link
Author

mafar commented Mar 8, 2019

it will be very standard experience if user is given all flag choices instead of forcing it.

@mafar
Copy link
Author

mafar commented Mar 8, 2019

oh and return result would be
[ [match0] [match1] [match..n]] instead of [match0] which is case right now

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

1 participant