in reply to Matching part of a path
(\S+) will capture one or more non-space characters, so you get your 'a/ff.pl'
$a =~ /^(\/home\/)(\W)(\S+).*$/(\W) will capture a single non word character, so it gets nothing.
$a =~ /^\/home\/(\w)/ # note the lowercase 'w'(\w) will capture a single word character. (it will go into $1 as you don't require any other captures).
cheers,
J
|
|---|