Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: regular expressions with !

by ozone (Friar)
on Sep 14, 2006 at 14:19 UTC ( [id://572927]=note: print w/replies, xml ) Need Help??


in reply to regular expressions with !

try using 'not' instead of '!', like so:

... if(not $test_string =~ /$regex/) { ... } ...

It's basically a question of operator precedence.

To make your intentions clearer, you should probably use the '!~' operator:

... if($test_string !~ /$regex/) { ... } ...

Replies are listed 'Best First'.
Re^2: regular expressions with !
by ikegami (Patriarch) on Sep 14, 2006 at 14:27 UTC
Re^2: regular expressions with !
by Tomte (Priest) on Sep 14, 2006 at 14:37 UTC

    It is considered good style to mark such a massive edit of a node as you have done here...either strike old content out, or at least leave a note like Edit: ....

    regards,
    tomte


    An intellectual is someone whose mind watches itself.
    -- Albert Camus

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (7)
As of 2024-04-24 09:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found