U
Une Bévue
I wanted to test userAgent by a Regexp
the goal :
true if UA contains "AppleWebKit/528+ " or "AppleWebKit/525.12+ " note
the final "+"
false otherwise
then i wrote :
var re=new Regexp(" AppleWebKit/[^ ]+\+ ");
var isWebkitNightly=re.test(navigator.userAgent);
and i got the following error with Firefox3RC1 :
invalid quantifier +
however, testing that way :
var isWebkitNightly=/ AppleWebKit\/[^ ]+\+ /.test(navigator.userAgent);
works fine.
why ?
the goal :
true if UA contains "AppleWebKit/528+ " or "AppleWebKit/525.12+ " note
the final "+"
false otherwise
then i wrote :
var re=new Regexp(" AppleWebKit/[^ ]+\+ ");
var isWebkitNightly=re.test(navigator.userAgent);
and i got the following error with Firefox3RC1 :
invalid quantifier +
however, testing that way :
var isWebkitNightly=/ AppleWebKit\/[^ ]+\+ /.test(navigator.userAgent);
works fine.
why ?