Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

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

by pKai (Priest)
on Aug 02, 2007 at 19:15 UTC ( #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
Node Status?
node history
Node Type: note [id://630363]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (2)
As of 2021-04-18 18:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?