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

Re: User regexps

by Roy Johnson (Monsignor)
on Jan 14, 2004 at 16:33 UTC ( [id://321294]=note: print w/replies, xml ) Need Help??


in reply to User regexps

How could a user specify a regexp meaning, "Any string that does not have the phrase 'foo' in it?"
Abigail gave an elegant one. I would expect this variation to be a little more efficient by virtue of only engaging lookahead upon encountering an f: /^(?:[^f]*f(?!oo))*[^f]*$/s;

The PerlMonk tr/// Advocate

Replies are listed 'Best First'.
Re: Re: User regexps
by ysth (Canon) on Jan 14, 2004 at 16:50 UTC
    //s there is useless, since it only affects .
      As useless as the pockets on my Cargo Cult pants from Old Navy®.

      Update: Your suggestion of /^.*(?!foo)/ is the Right Way To Do It, anyway.


      The PerlMonk tr/// Advocate

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (2)
As of 2024-04-20 03:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found