Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Difference between these regexes (elaboration)

by tye (Sage)
on Jul 29, 2016 at 14:32 UTC ( #1168820=note: print w/replies, xml ) Need Help??


in reply to Difference between these regexes

2 and 3 are equivalent (and I'll bet that 2 is less efficient). 1 is also equivalent as-is. However, if you were to use these constructs as part of a larger regex, then 1 would not always be equivalent.

#!/usr/bin/perl -l $_ = '<left>no<right>yes'; /<(.*?)>y/s; print $1; /<([^>]*)>y/s; print $1; __END__ left>no<right right

- tye        

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (1)
As of 2020-10-25 16:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (249 votes). Check out past polls.

    Notices?