Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Re: pattern matching

by perlcgi (Hermit)
on May 04, 2004 at 13:59 UTC ( #350338=note: print w/replies, xml ) Need Help??


in reply to Re: pattern matching
in thread pattern matching

Be careful using .* as it is one greedy mother. The first .* will swallow everything up to the second last // in your regex.
So if your source text ever happens to have three or more sets of // on a line you regex will fail. Better to use nongreedy, minimal matching using .*?
This is probably so obvious to an expert like Corion, he didn't bother mentioning it. I mention it 'cos the OP states that the regex seems to work.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2022-12-03 23:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?