in reply to Re: One true regexp for untainting windows filenames?
in thread One true regexp for untainting windows filenames?
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;
--
જલધર
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: One true regexp for untainting windows filenames?
by ikegami (Patriarch) on Jan 09, 2009 at 05:33 UTC |
In Section
Seekers of Perl Wisdom