Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

•Re: Problem with negative lookahead at end of string

by merlyn (Sage)
on Jun 21, 2004 at 15:45 UTC ( [id://368483]=note: print w/replies, xml ) Need Help??


in reply to Problem with negative lookahead at end of string

For simplicity sake, you can list a compound "and-ed" condition as a series of null assertions:
/ ^ # anchor so as not to try this at every spot (?= chars ) # stars with chars (?= .*? this ) # contains this (?! .*? that ) # does not contain that (?! .* whatever $ ) # does not end in whatever /xs

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.

update: edited to include additional whitespace for readability

Replies are listed 'Best First'.
Re^2: Problem with negative lookahead at end of string
by melora (Scribe) on Jun 21, 2004 at 17:35 UTC
    Nice. "I'd walk a mile for a (Programming Perl) Camel." Had to reach for it to get through that ?!.*? regex! I'm just an old C programmer, learning more than one way to do it...

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (6)
As of 2024-04-19 13:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found