M
Matt Kruse
Are there any current browsers that have Javascript support, but not RegExp
support?
For example, cell phone browsers, blackberrys, or other "minimal" browsers?
I know that someone using Netscape 3 would fall into this category, for
example, but that's not a realistic situation anymore.
And if such a condition exists, then how do you guys handle validation using
regular expressions, if the browser lacks them?
For example:
function isDigits(val) {
if (window.RegExp) {
return !(val.search(/^\d+$/)==-1);
}
else {
// No regexp support
// ????
}
}
If no RegExp support, then should brute-force methods be used using indexOf,
substr, etc? (not for this specific method, but the general case).
And if that's the case, then why even include the duplicate regexp code to
begin with?
Or if the brute-force method should not be used, then what should be
returned? undefined? null? Then the method becomes less useful, because it
doesn't return true or false consistently like a user might expect. Having
an "isX" method that returns "I don't know" makes it very difficult to
validate forms, etc
Just curious what others have concluded, and if the "js enabled but no
RegExp support" condition is even realistic?
support?
For example, cell phone browsers, blackberrys, or other "minimal" browsers?
I know that someone using Netscape 3 would fall into this category, for
example, but that's not a realistic situation anymore.
And if such a condition exists, then how do you guys handle validation using
regular expressions, if the browser lacks them?
For example:
function isDigits(val) {
if (window.RegExp) {
return !(val.search(/^\d+$/)==-1);
}
else {
// No regexp support
// ????
}
}
If no RegExp support, then should brute-force methods be used using indexOf,
substr, etc? (not for this specific method, but the general case).
And if that's the case, then why even include the duplicate regexp code to
begin with?
Or if the brute-force method should not be used, then what should be
returned? undefined? null? Then the method becomes less useful, because it
doesn't return true or false consistently like a user might expect. Having
an "isX" method that returns "I don't know" makes it very difficult to
validate forms, etc
Just curious what others have concluded, and if the "js enabled but no
RegExp support" condition is even realistic?