in reply to Finding all pages in a path

if ($mypath =~ m{(?:^|/)mydirectory/dirOne/pagehere\.cgi$}) { print "results here"; } if ($mypath =~ m{(?:^|/)mydirectory/dirOne/[^/]+\.cgi$}) { print "results here"; }

(?:^|/)mydirectory
makes sure we don't match
notmydirectory

[^/]+
means "one or more of (not a slash)".