Use .*? for immediate match
See the changes below of your code:
my $s = '<blah>red</blah><blah>white</blah><blah>blue</blah>'; while ($s=~/<blah>(.*?)<\/blah>/) { # this RE isn't right... print "\n$1";sleep 1; }
Update:: Remove /g
In reply to Re: non-greedy incremental regular expression?
by gopalr
in thread non-greedy incremental regular expression?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |