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

Re: regular expression

by Narveson (Chaplain)
on Aug 03, 2012 at 14:45 UTC ( #985252=note: print w/ replies, xml ) Need Help??


in reply to regular expression

Your regular expression /.*_?(.*)/ starts with .*, which matches any string of any length. The _?(.*) matches the empty string that remains after your first piece has matched everything. So you captured the empty string.

When you review the manual, pay special attention to the meaning of the quantifiers * and ?.


Comment on Re: regular expression
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://985252]
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: (6)
As of 2014-11-29 09:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (204 votes), past polls