Hi, I'm having trouble coming up with the correct regular expressions to use in mask. The field I need to validate has the following rules: 1.length should be 10 characters - using minlength and maxlength for this - and it works fine. 2.accepted chars are 0 to 9 and the letter X - the value in my validation.xml is as follows: <var> <var-name>mask</var-name> <var-value>^[0-9X]$</var-value> </var> Am I setting up the regular expression incorrectly ? Any pointers will be very helpful.
The regex you've setup says: The string is valid if it contains 0-9 or X and one character long, you'll need to add that you want it to be 10 characters long.
^[0-9X]{10}$
Given that you are now checking it's length with the regex, you can get rid of the min/max length bits if you want.
Hello, The field I need to validate needs to be 10 characters long, and can contain numbers 0 to 9, and the letter X. The mask value I have set up is: <var-name>mask</var-name> <var-value>[0-9X]${10}</var-value>
This allows the following value to be entered and saved, which is not acceptable. 345678yyy8 Is my regular expression incorrect ? Any hints will be greatly appreciated.
Thanks, Mallika.
F is for finger. Can you stick your finger in your nose? Doesn't that feel nice? Now try this tiny ad: