Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^3: dir match, dir may or may not appear

by hippo (Bishop)
on Jan 12, 2016 at 10:34 UTC ( #1152547=note: print w/replies, xml ) Need Help??


in reply to Re^2: dir match, dir may or may not appear
in thread dir match, dir may or may not appear

The "?" quantifier means to match 0 or 1 times as specified in the "Quantifiers" section of perlre. Therefore your pattern to match this could be simply (/[^/]+)? which is similar to QuillMeantTen's approach above.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (3)
As of 2022-07-04 03:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?