princepawn has asked for the wisdom of the Perl Monks concerning the following question:
$_ = "1122a44"; while( m/\G(\d\d)/gc ) { print "Found $1\n"; }
But I wanted it to print 44 also. But it didn't. I read the perlop manpage to say that the c modifier allowed the matching to continue after a fail.[tbone@horse1 US]$ perl g.pl Found 11 Found 22 [tbone@horse1 US]$
Is there anyway to match the final 44 if c is not what I want as a modifier?
Carter's compass: I know I'm on the right track when by deleting something, I'm adding functionality
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: [perlre] \G with /gc does not catch last match for me
by skyknight (Hermit) on Aug 05, 2003 at 17:25 UTC | |
by princepawn (Parson) on Aug 05, 2003 at 17:53 UTC | |
by Juerd (Abbot) on Aug 05, 2003 at 18:15 UTC |