This regular expression will contain 10, but allow no more than 12:
^([0-9]{10,12})$
Here is a Regex 101 to prove it.
This will only allow 10 or 12 only , and the 11-digit number will not be executed.
^([0-9]{10}|[0-9]{12})$
Here is a Regex 101 to prove it.
This will allow 1 to 12 digits:
^([0-9]{1,12})$
You have now set EnableClientScript to false. This means that JavaScript will not be checked on the client side. However, you need to make sure that you call this.Validate() to force a check on the page before trying to check if there is an IsValid validator.
source share