in reply to Regex Improvement
Also as I0 alluded to, the period in the character class is a little more...generous...than you think.
Perl on Win32 will accept "/" as a valid path delimiter.
You may or may not wish to pass this freedom along to your users.
Did you want to complicate the possibility that the current working directory is the home directory? If not then throw a ? after the first path delimiter.
Likewise it is generally a bad idea to assume you had a match and then accept $1. Test whether the match succeeded. Else mistakes will turn into the assumption that the home directory is the working directory, or else the output of a previous match will be accepted instead.
|
|---|