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

Re: dir match, dir may or may not appear

by hellosarathy (Novice)
on Jan 12, 2016 at 10:26 UTC ( #1152546=note: print w/replies, xml ) Need Help??


in reply to dir match, dir may or may not appear

Thanks... what you gave worked:
$path =~ m|^usr/(?:/[^/]+)?/bin/|

Replies are listed 'Best First'.
Re^2: dir match, dir may or may not appear
by GrandFather (Saint) on Jan 13, 2016 at 05:34 UTC

    As a general thing don't use | as a regex delimiter because it is the alternation (or) character. It allows you to match cat or dog m~cat|dog~ for example.

    Premature optimization is the root of all job security

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (2)
As of 2022-08-15 12:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?