W
williamc
The same regexp that seems to be working on the server side in Perl
seems to be failing on the client side in JavaScript... I want to match
a string that's exactly 7 alpha-numeric characters. So I used...
var reSCode = /^[a-zA-z0-9]{7}$/;
....
if (frm.elements["ServiceCode"].value == "") {
alert("Service Code is a required field.");
return;
} else {
strServiceCode = frm.elements["ServiceCode"].value;
if (!(reSCode.test(strServiceCode))) {
alert("The Service Code that you entered blah blah...");
return;
}
}
However, when the user enters an underscore re.test() seems to be
returning true... Can somebody explain why?
thx,
--williamc
seems to be failing on the client side in JavaScript... I want to match
a string that's exactly 7 alpha-numeric characters. So I used...
var reSCode = /^[a-zA-z0-9]{7}$/;
....
if (frm.elements["ServiceCode"].value == "") {
alert("Service Code is a required field.");
return;
} else {
strServiceCode = frm.elements["ServiceCode"].value;
if (!(reSCode.test(strServiceCode))) {
alert("The Service Code that you entered blah blah...");
return;
}
}
However, when the user enters an underscore re.test() seems to be
returning true... Can somebody explain why?
thx,
--williamc