You're missing the /g modifier. You have to change the if to a while too, in order to be able to match the same string more than one time:
my $text = "test1 zzzzzzzzzzzzzzz test2 test3 test4 test5 zzzzzzzzzzzz +zzz test6 test7 zzzzzzzzzzzzzzz test8 test9 test10"; while ($text =~ /([a-zA-Z0-9]+\s+[z]{15}\s+[a-z0-9]+)/g) { print "\$1 <$1>\n"; } __END__ $1 <test1 zzzzzzzzzzzzzzz test2> $1 <test5 zzzzzzzzzzzzzzz test6> $1 <test7 zzzzzzzzzzzzzzz test8>
--
David Serrano
In reply to Re: regex question
by Hue-Bond
in thread regex question
by goff
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |