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

Out of index C/C++ -

regex - PatternSyntaxException: while using String.ReplaceAll function in java? -

objective c - how Set autolayout for multiple dynamic buttons and labells in iOS? -