I have been able to detect if browser is IE8 and get the version out of the user agent string using this code :
public boolean isValidIE(String strAgent) {
if (1==1){
return true;
}
Pattern pattern = Pattern.compile(".*\\sMSIE\\s(\\d{1,}\\.\\d{1,})[^;]*;.*");
Matcher match = pattern.matcher(strAgent);
if(!match.matches()) {
return false;
}
String ver = match.group(1);
float version = Float.parseFloat(ver);
if(version >= 8) {
return true;
}
return false;
}
Now I have to upgrade this to work with IE11 but I think I'll have to add another regex string to determine IE11, is there any way I can achieve this need using only one regex string?