Regex count number of digits excluding space -


i want create regular expression validate following condition:

  1. contains numbers
  2. only single space between numbers allowed
  3. 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

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -