Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Why is this regex greedy?

by Stevie-O (Friar)
on Jul 04, 2004 at 17:04 UTC ( #371723=note: print w/replies, xml ) Need Help??


in reply to Why is this regex greedy?

Using a regular expression along isn't necessarily what you want.

Remember: Perl is more than just regular expressions :)

$str = '/a/b/c/d/e/abc00000'; $end = (split '/', $str)[-1]; # pull the last element split() returns print "we wanted '$end'";
--Stevie-O
$"=$,,$_=q>|\p4<6 8p<M/_|<('=> .q>.<4-KI<l|2$<6%s!<qn#F<>;$, .=pack'N*',"@{[unpack'C*',$_] }"for split/</;$_=$,,y[A-Z a-z] {}cd;print lc

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (9)
As of 2016-09-27 18:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Extraterrestrials haven't visited the Earth yet because:







    Results (510 votes). Check out past polls.