Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Re^3: qr for recursive regex?

by Limbic~Region (Chancellor)
on May 28, 2014 at 19:20 UTC ( [id://1087707] : note . print w/replies, xml ) Need Help??

in reply to Re^2: qr for recursive regex?
in thread qr for recursive regex?

If you use a regex with the global modifier in scalar context, you will get an iterator allowing you to go through each set of matches one at a time (like one of the examples above):
while ($str =~ m{$your_regex}g) { my ($x, $y) = ($1, $2); # This loop will repeat for as many matches as are in $str }

Cheers - L~R