Thanks for the tip. I found slightly more understandable code in File::Spec which has resulted in the following regexps: for Unix...
...and Windows (includes UNC paths)...qr{(\A (?: .* / (?: \.\.?\z )? )? [^/]* )}msx;
qr{(\A (?: [a-zA-Z]: | (?:\\\\\\\\|//)[^\\\\/]+[\\\\/][^\\\\/]+ )? (?:.*[\\/](?:\.\.?\Z(?!\n))?)? .* )}msx;
--
જલધર
In reply to Re^2: One true regexp for untainting windows filenames?
by jaldhar
in thread One true regexp for untainting windows filenames?
by jaldhar
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |