Hi.
I have debugged and understood your problem. Reg. Exp. tested every input character. It works as
Code: Select all
var ok = re.test(c);
if(!ok) {
e.preventDefault();
}
Where "re" is your reg. expression /..../ and "c" current sign you input. Sure, it will not work. For instance this reg exp. /[0-9][0-9]/ returns false if you input 4, but true if you input 44. Because you should test the entire input string against reg. expression. Use testFunction instead. In the test function you can read the input string with jQuery and test with reg. expression every input position. For instance, you know that you 1. character should be (. You can read input string from p:inputText, call getCharAt(0) and compare with (. I can't see any other way. You can test if you input e.g. only digits or only alphanumeric values, but exactly test char for char is difficult.