Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
Re: How do I reference repeated capture groups?by kcott (Archbishop) |
on Aug 13, 2022 at 02:40 UTC ( [id://11146134]=note: print w/replies, xml ) | Need Help?? |
G'day TIOOWTDI, Welcome to the Monastery. You actually want to capture zero or more instances of '(\s*\d+\s*)'; i.e. '((?:\s*\d+\s*)*)'. Your OP code:
With fixed regex:
Named captures don't change the regex logic. The start of capture groups changes from '(' to '(?<name>'; and, accessing values changes from '$N' to '$+{name}'.
— Ken
In Section
Seekers of Perl Wisdom
|
|