Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^2: Regexp Confuzzelemt

by ikegami (Pope)
on Apr 28, 2007 at 02:37 UTC ( #612494=note: print w/ replies, xml ) Need Help??


in reply to Re: Regexp Confuzzelemt
in thread Regexp Confuzzelemt

But it also matches "TTT" in "aaaaaaaa#TTT"

That's a difference you introduced. If you put the \? back in, it won't.
/#(.*?)\?/
is equivalent to
/#([^?]*)\?/

The latter is safer. It's easy to introduced problems when using non-greedy quantifiers. They're not as resilient. For example, you can safely embed the greedy regexp in a larger regexp, but you can't safely embed the non-greedy regexp in a larger regexp.


Comment on Re^2: Regexp Confuzzelemt
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (16)
As of 2014-08-22 18:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (163 votes), past polls