Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

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

by pKai (Priest)
on Aug 02, 2007 at 19:15 UTC ( [id://630363]=note: print w/replies, xml ) Need Help??


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

...regex /([^:]+)/ which tells perl to eat everything until it reaches the ":".

...unless the input begins with a colon, when the regex will start its eating i. e. matching after the leading colon(s).

So the "exact" equivalent to /([^:]+)/ would be /((?:.(?!stop))+.)/, while the "eat up until" case might be something like /\G((?!stop)(?:.(?!stop))+.)/, corresponding /([^:]*)/, or so I hope.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (4)
As of 2024-04-23 15:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found