in reply to Re: regex only matching from last match
in thread regex only matching from last match
Try those matches without the //g modifier.>perl -wMstrict -le "my $str = '123 456 789'; print qq{1st match: $1} if $str =~ m{ (\d{3}) }xmsg; print qq{2nd match: $1} if $str =~ m{ (\d{3}) }xmsg; print qq{3rd match: $1} if $str =~ m{ (\d{3}) }xmsg; " 1st match: 123 2nd match: 456 3rd match: 789
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: regex only matching from last match
by Foxpond Hollow (Sexton) on Sep 24, 2009 at 16:44 UTC |