I have the following regex which validates that a string contains only numbers and is between 10 and 11 characters in length.
^[0-9]{10,11}$
However, if the string has a length of 11, I need to validate that the first character is a 1. If the length of the string is 10, no further validation is necessary.
examples of valid strings
3455558899
15554445555
example of an invalid string
25554445555
85554445555
Is this possible with regex? BTW, this regex will be used in a Java application.