Perl Monk, Perl Meditation | |
PerlMonks |
Re^3: dir match, dir may or may not appearby hippo (Bishop) |
on Jan 12, 2016 at 10:34 UTC ( [id://1152547]=note: print w/replies, xml ) | Need Help?? |
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.
In Section
Seekers of Perl Wisdom
|
|