I have want to create a regex pattern that will provide a match for a safari user agent string. The problem is that Chrome also seems to match:
Safari Regex:
(?!Chrome).*Safari
This still matches against a Chrome user agent string, but I thought that the negative look ahead would resolve this issue?
Chrome user agent:
Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.73 Safari/537.36
Safari user agent:
Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.4 Safari/533.20.27
Can anyone provide me with a regex solution for this?
Update:
The answer I was directed to at Efficient User-Agent Regex to find Safari in Python does not provide a regex solution for this problem. In fact, it doesn't address the issue at all, so I am suprised it was accepted as an answer
Thanks
^(?!.*Chrome).*Safarior, to ensure whole words are checked for,^(?!.*\bChrome\b).*\bSafari\b