Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Can't match negated words.

by kesterkester (Hermit)
on Jun 24, 2004 at 12:29 UTC ( #369315=note: print w/ replies, xml ) Need Help??


in reply to Can't match negated words.

Hi Mark--

The /[^throw]/ regexp isn't doing what you think it's doing-- you've created a character class (with the square brackets) containing the letters 't', 'h', 'r', 'o', and 'w', and are matching on anything that doesn't contain those (the ^ negates a character class. So if the throw line in your Java contains ANY characters that aren't t,h,r,o, or w, it'll match. This is why you're getting unexpected behaivior.

You're on the right track with using !~. That should do what you mean.

Try running "perldoc perlre" on your local system for a good intro to this type of thing.


Comment on Re: Can't match negated words.
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (8)
As of 2014-09-01 09:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (300 votes), past polls