Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Tell regex to stop at "phrase", instead of char - how?

by JediWizard (Deacon)
on Aug 02, 2007 at 18:08 UTC ( #630354=note: print w/replies, xml ) Need Help??


in reply to Tell regex to stop at "phrase", instead of char - how?

See perlre

m/(?:(?!somephrase).)*/;

"A zero-width negative look-ahead assertion. For example /foo(?!bar)/ matches any occurrence of "foo" that isn't followed by "bar". Note however that look-ahead and look-behind are NOT the same thing. You cannot use this for look-behind."


They say that time changes things, but you actually have to change them yourself.

—Andy Warhol

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2021-06-14 22:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What does the "s" stand for in "perls"? (Whence perls)












    Results (66 votes). Check out past polls.

    Notices?