I have 2 strings:
a) Firefoxb) Firefox NavigatorI want my regex to pass if it finds Firefox and not Navigator - so (a)I'm trying Firefox[^Navigator] without sucess, any input would be appreciated!
That is not a clear enough problem description. It is not clear if the string should be rejected if "Navigator" comes right after "Firefox" or should the string "Firefox some other text Navigator" also be rejected? And what about strings that have "Navigator" before "Firefox"? Does case matter or should "fireFOX NavigaTOR" also be rejected? And what about multiple strings or line breaks in between "Firefox" and "Navigator"?
Anyway, please first check this thread to see if you can solve your problem: http://regexadvice.com/forums/thread/49008.aspx
If not, feel free to post back with a more detailed question.
Good luck.
Are you attempting to test browser ident strings? In that case I'm not aware of one that includes both Firefox and Navigator.
(?=.*\bFirefox\b)(?!.*\bNavigator\b).*
If it matches then Firefox was found without Navigator, in any order.
Thanks for the replies.
Yup, testing browser UA strings, here is an example of one:Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.12) Gecko/20080219 Firefox/2.0.0.12 Navigator/9.0.0.6
Was able to use your suggestion above.
cheers