Regex count number of digits excluding space -
i want create regular expression validate following condition:
- contains numbers
- only single space between numbers allowed
- total digits excluding spaces must between 16 19
here regular expression have far :
^[0-9]+( [0-9]+)*$
basically got condition (1) , (2) really need (3). thank time.
piece of cake.
^\d( ?\d){15,18}$
only thing worth remarking on {15,18}
needs 1 less -- first \d
ate digit.
Comments
Post a Comment