Any idea on how to write a regular expression that matches a substring ‘urgent’ as long as it doesn’t contain ‘not’ before ‘urgent’?
ex.
this is urgent – match!
[not urgent] blah – don’t match
For Ruby 1.9.2, this works
/(?<!not )urgent/
-uses negative look behind
You can use the following regex:
Sample match: http://regexr.com?2trsp