0

I want to write a regular expression to match cases where the sentence contain the words 'business intelligence'. However, I do not want a match to be returned if the sentence contains the words 'business intelligence and analytics'.

I tried using

      /Business Intelligence (?<! and Analytics)/
  • I was confused too when I first read about lookaheads and lookbehinds in the sense that the names seem backward for what each does. – tenub Apr 08 '14 at 19:44
  • Which tool are you using for your regex? – anubhava Apr 08 '14 at 19:45
  • The [Regex-Fu FAQ Mega Wiki](http://stackoverflow.com/a/22944075/2736496) say: [match a string not containing a word](http://stackoverflow.com/q/406230) – aliteralmind Apr 08 '14 at 20:56

1 Answers1

1

You should use negative lookahead:

/Business Intelligence(?! and Analytics)/
                        ^ I have removed the < from here
Sabuj Hassan
  • 35,286
  • 11
  • 68
  • 78