in reply to Re^3: Regex to detect file name
in thread Regex to detect file name

Hm, I think I understand the problem. The OP's regex:
if($view_tag =~ m/[^A-Za-z0-9_\-\.]/) {
actually has a negative character class (leading ^), rather than a start-of-string anchor.

So the OP had to negate the pattern.

My guess is that the OP really meant:

if($view_tag =~ m/^[A-Za-z0-9_\-\.]/) {
Update: fixed a typo: s/or-string/of-string/

Replies are listed 'Best First'.
Re^5: Regex to detect file name
by AnomalousMonk (Archbishop) on Jul 06, 2018 at 01:14 UTC
    My guess is that the OP really meant ...

    My guess is that your guess is probably pretty good, but lirc201 is the only one who can clear this up and I doubt we'll hear much more from that quarter. I guess this is just another mystery to be filed in the big, empty drawer labeled X. :)


    Give a man a fish:  <%-{-{-{-<