Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: regular expressions with !

by ozone (Friar)
on Sep 14, 2006 at 14:19 UTC ( #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? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2022-05-28 20:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (101 votes). Check out past polls.

    Notices?