Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^2: Regex to detect file name

by lirc201 (Initiate)
on Jul 05, 2018 at 19:07 UTC ( [id://1217984]=note: print w/replies, xml ) Need Help??


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

Thank you so much. I actually just changed the =~ to !~ and it works as expected with your regex.

Replies are listed 'Best First'.
Re^3: Regex to detect file name
by AnomalousMonk (Archbishop) on Jul 05, 2018 at 20:04 UTC
    I actually just changed the =~ to !~ and it works as expected with your regex.

    I don't understand from the OP what you want, and so I don't understand how the logical negation of Corion's regex gives you what you want. Can you elucidate, perhaps with some matching and non-matching example strings? Are you sure you're really matching what you think you're matching? (Please see perlre, perlretut, and perlrequick.)


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

      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/
        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:  <%-{-{-{-<

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1217984]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (7)
As of 2024-04-25 15:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found