in reply to Regex to detect file name
I would instead specify what is allowed, which makes for a simpler regular expression in your case:
if($view_tag =~ m/\A[A-Za-z0-9][A-Za-z0-9_\-\.]+\z/) { # everything is OK } else { die "Invalid/disallowed filename '$view_tag'"; };
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Regex to detect file name
by lirc201 (Initiate) on Jul 05, 2018 at 19:07 UTC | |
by AnomalousMonk (Archbishop) on Jul 05, 2018 at 20:04 UTC | |
by Laurent_R (Canon) on Jul 05, 2018 at 21:56 UTC | |
by AnomalousMonk (Archbishop) on Jul 06, 2018 at 01:14 UTC |