Can anyone explain what is being done below?
$name=~m,common/([^/]+)/run.*/([^/]+)/([^/]+)$,;
common, run and / 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]\n optionally matches a Line Feed.\z matches 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/XXXWhere
XXX is a sequence of at least one character that doesn't contain /.YYY is a sequence of any number of characters (incl zero) that doesn't contain /.It matches more than that, however.
uncommon/XXX/runYYY/XXX/XXXcommon/XXX/runYYY/XXX/XXX/XXX/XXX/XXX/XXXThe parts in bold are captured (available to the caller).
s flag isn't used.m flag isn't used.
$namefor a match againstcommon/*/run*/*/*, in term of shell (bash, zsh, csh, ...), perhaps match against to some path in filesystem. It can be rewritten as$name =~ m!common/.*?/run.*?/.*?/.*?$!;common/*/run*/*/*in term of shell", I think that's what it was meant to do, but that's not what it does..*can match strings containing/. /// @PolarBear Re "It can be rewritten as", All those?are pointless. Your rewrite can matchcommon/foo/run/bar/baz/moo/moo/moo/moo/moo/moo/moo/moo/moo. I don't think you intended that. Remember that^/.*?/$matches///.