If you change the multipliers, it also works in Opera:
function isValidHex(hex) {
var objPattern = /^#([0-9a-f]{3}){1,2}$/i;
return objPattern.test(hex);
}
, (, 3 3 + 3 ), (, 1 + 1 + 1, 2+ 1 + 1, 2 + 2 + 1 2 + 2 + 2 ).
( , varaible strPattern objPattern, , . , , .)