I needed some code to match all IE6 versions that are not SP1 (part of Windows XP SP2, confusing eh). This is to turn gzip off for versions of IE that do not handle it properly.
The best I have come up with is:
MSIE [1-6]\.(?!.*?SV1)
Does anyone have a better pattern? What the regex above does is basically do a lookahead to make sure that the SV1 (which indicates SP1) does not exist.
For testing purposes, this should not match:
Mozilla/5.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4325)
But this should:
Mozilla/4.0 (Windows; MSIE 6.0; Windows NT 6.0)