Reputation: 43
I am stuck trying to get numbers without commas in front of a number.
Here is what I am using:
^(\d{1,3})$|(,\d{3})$
Here is the match:
3
62
115
112,266,455
989,564,654
137,150
,137,150
I don't want ,137,150
.
Upvotes: 3
Views: 114
Reputation: 225281
Assuming those matches you listed should all be the same match, you should combine those groups and allow ,###
to be repeated any number of times:
^\d{1,3}(,\d{3})*$
Upvotes: 2