Saturday, November 12, 2011

match a word as long as another word doesn't appear before it

match 'haha' as long as 'example' doesn't come first
/^((?:(?!example).)*)(haha.*)$/
excellent post about *not* matching a word: http://stackoverflow.com/questions/406230/regular-expression-to-match-string-not-containing-a-word

No comments:

Post a Comment