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
In reply to Re^2: regex only matching from last match
by AnomalousMonk
in thread regex only matching from last match
by Foxpond Hollow
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |