Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

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

by Anonymous Monk
on Aug 02, 2007 at 23:41 UTC ( [id://630420]=note: print w/replies, xml ) Need Help??


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

/([^(stop)]+)/ Not particularly efficient, but it works...

Replies are listed 'Best First'.
Re^2: Tell regex to stop at "phrase", instead of char - how?
by ikegami (Patriarch) on Aug 03, 2007 at 12:17 UTC

    No, it doesn't work. To work, it not only needs to match when it should match, it needs to not mach when it shouldn't match. Yours fails to do the latter.

    /([^(stop)]+)/ is the same as /([^()opst]+)/. It doesn't look for "stop" at all, just individual characters.

    You basically took the regexp the OP said didn't work, and made it not work in more places. For example, your solution stops wherever a paren is encountered.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (8)
As of 2024-04-25 11:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found