Works perfectly well for me. Note that the s modifier that I added to the RE allows your extracted text to extend across multiple lines. I don't know if that will matter to you.use strict; my $text = <<EOT; foo this is one example bar this is a line I don't care about foo here's another keeper! bar foo yet another bar and a line to reject EOT while ($text =~/foo(.*?)bar/gs) { print "$1\n"; }
In reply to Re (tilly) 3: Delving the regexp underdark -- how to understand \G's behavior, or how to loop through a regular expression
by tilly
in thread Delving the regexp underdark -- how to understand \G's behavior, or how to loop through a regular expression
by boo_radley
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |