in reply to Re (tilly) 1: Delving the regexp underdark -- how to understand \G's behavior, or how to loop through a regular expression
in thread Delving the regexp underdark -- how to understand \G's behavior, or how to loop through a regular expression

whoops.
the regexps ARE actually .*s. I was just too busy being witty to notice the typo.
  • Comment on Re: Re (tilly) 1: Delving the regexp underdark -- how to understand \G's behavior, or how to loop through a regular expression

Replies are listed 'Best First'.
Re (tilly) 3: Delving the regexp underdark -- how to understand \G's behavior, or how to loop through a regular expression
by tilly (Archbishop) on Feb 02, 2001 at 21:22 UTC
    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"; }
    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.