How to access non-capturing groups | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to access non-capturing groups

As it cannot be accessed through group index

28th Sep 2016, 11:28 PM
Rohit Kumar
2 Answers
+ 1
They're...not captured. You might try running the regex on the target, with only the non-capturables (remove the capture filter indicator). You should get them all by themselves, unless I'm missing something (totally possible).
30th Sep 2016, 4:47 PM
Kirk Schafer
Kirk Schafer - avatar
0
Correction: non-capturing groups are captured by group() along with everything else. They are not captured by group(n) and they are not captured by groups() but they ARE captured by group().
21st Sep 2020, 5:06 AM
Nassim Abed
Nassim Abed - avatar