JavaScript Regex should be only containing N numeric characters -


I need javascript regexp to validate some patterns
  745128 745128, 184122 745128, 184122, 425412   

The value separated by each comma should only contain 6 numeric characters

You can try regex below.

  ^ \ d {6} (?:, \ S \ d {6}) * $   

or

one The second option was added because I do not know clearly about the empty space.

Strong> Explanation:

  ^ starts with string \ d {6} digits (0-9) (6 times) (?: Group, but do not capture (0 or more) Bar): 'white space' (\ n, \ r, \ t, \ F, and "") \ d {6} digits (0-9) (6 times)) * from an optional \ n The end of the first grouping, and the end of the string    

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

python - 'NoneType' object is not callable using 'find_all' in BeautifulSoup -