I need to block IE versions upto 6. for user agent strings I wrote a regex which blocks IE 4 5 and 6. But I came across this string:
Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; TheFreeDictionary.com; FunWebProducts; FBSMTWB; GTB6; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; InfoPath.2)
In this string, there is MISE 6.0 mentioned so my regex blocks it. However it is actually IE 8 browser. So how can I construct a regex that scans for IE which is above 6 and if IE 4-5-6 appears again in the string it will ignore it.
Do not look for occurrences of
MSIE 6.0to block, detect the version as a floating point number with code like this: (You didn’t specify a language so I give the example in PHP)The code above will use the first occurrence of
MSIE x.xto detect the version and will ignore the rest.UPDATE:
In Javascript: