Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Difference between these regexes (elaboration)

by tye (Sage)
on Jul 29, 2016 at 14:32 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1168820]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (5)
As of 2024-04-19 00:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found