0

I'm trying to identify IE11's various user agent strings using regex. I've read elsewhere that IE11 can be identified by having Trident/7.0 along with rv:11.0 however IE9 and IE10 have the same thing, but they also have MSIE somewhere in the beginning (before Trident).

How do I write a regex string that matches the Trident and the rv:11 but also excludes the MSIE?

Thanks!

Barmar
  • 741,623
  • 53
  • 500
  • 612
Danny Ackerman
  • 997
  • 1
  • 10
  • 25
  • That thread is actually about detecting IE in general, not specifically IE11. But if you check its **Related** links, you'll see also http://stackoverflow.com/questions/17447373/how-can-i-target-only-internet-explorer-11-with-javascript?lq=1 – Barmar Dec 20 '13 at 21:47
  • You would normally use a negative lookaround, but Javascript doesn't support it. The simplest way is to just use two regexps: check that it matches `Trident` and doesn't match `MSIE`. But see http://stackoverflow.com/questions/641407/javascript-negative-lookbehind-equivalent for a way to get something almost equivalent to negative lookbehind – Barmar Dec 20 '13 at 22:54

0 Answers0