Bowie Bailey wrote:
NFN Smith wrote:


  /\b(?!badword)(?:b.?a.?d.?w.?o.?r.?d.?)(\b|\!|\.|\,|\;|\:|\?)/i

I'm getting hits on things like 'baddword' and 'badwoord', and even
'badworrd!', but I'm not getting a hit on 'badwordd'

I've tried a number of variants, but still am not quite getting it.
What am I missing?

I think the negative lookahead is biting you.  Try this:

  /\b(?!badword\b)(?:b.?a.?d.?w.?o.?r.?d.?)(\b|\!|\.|\,|\;|\:|\?)/i

That one seems to do the trick.  Thanks for the help.

Smith

Reply via email to