Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: non-greedy incremental regular expression?

by gopalr (Priest)
on May 14, 2005 at 04:11 UTC ( [id://456972]=note: print w/replies, xml ) Need Help??


in reply to non-greedy incremental regular expression?

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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://456972]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (3)
As of 2024-04-20 01:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found