Can anyone explain what is being done below?
$name=~m,common/([^/] )/run.*/([^/] )/([^/] )$,;
CodePudding user response:
common,runand/are match themselves.()captures.[^/]matches 1 or more characters that aren't/..*matches 0 or more characters that aren't Line Feeds.[1]$is equivalent to (\n?\z).[2]\noptionally matches a Line Feed.\zmatches the end of the string.
I think it's trying to match a path of one or both of the following forms:
.../common/XXX/runYYY/XXX/XXXcommon/XXX/runYYY/XXX/XXX
Where
XXXis a sequence of at least one character that doesn't contain/.YYYis a sequence of any number of characters (incl zero) that doesn't contain/.
It matches more than that, however.
- It matches
uncommon/XXX/runYYY/XXX/XXX - It matches
common/XXX/runYYY/XXX/XXX/XXX/XXX/XXX/XXX
The parts in bold are captured (available to the caller).
- When the
sflag isn't used. - When the
mflag isn't used.
