Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Find all strings containing "a" characters, that are not followed by "b" characters.

by bart (Canon)
on Dec 12, 2012 at 17:59 UTC ( #1008540=note: print w/replies, xml ) Need Help??


in reply to Find all strings containing "a" characters, that are not followed by "b" characters.

Try
/a(?!b)/
with negative lookahead.

And yes, your regexp looks rather OK, except I would drop a few \b anchors:

/a\b|a[^b]/
or combined:
/a(\b|[^b])/
Will that do?
  • Comment on Re: Find all strings containing "a" characters, that are not followed by "b" characters.
  • Select or Download Code

Replies are listed 'Best First'.
Re^2: Find all strings containing "a" characters, that are not followed by "b" characters.
by Anonymous Monk on Dec 12, 2012 at 18:04 UTC
    immediately after, and anywhere after, not the same :)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1008540]
help
Chatterbox?
and cookies bake in the oven...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (7)
As of 2016-12-08 20:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (147 votes). Check out past polls.