We have a following string:

one,two,three

And Question is: how we get the multiple groups of the same pattern.

Answer:
With one group in the pattern, you can only get one exact result in that group. If your capture group gets repeated by the pattern (you used the + quantifier on the surrounding non-capturing group), only the last value that matches it gets stored.

Let see more about it.

https://www.regular-expressions.info/captureall.html


转载请注明来源,https://blog.vicyu.com
由于水平有限,行文难免出错,恳请读者批评指正。