Reputation: 191
I need to create a regex that matches a "1,2,3,10,12312"
pattern.
As I understand it would start with /([""'])
to match the double quotes but I'm lost when I try to get to the \d digit and comma alternation.
what would be a valid regex to do that?
Upvotes: 0
Views: 84
Reputation: 43199
You have some choices, one being:
"\d+(?:,\d+)*"
To even allow empty double quotes (""
), change the expression to
"\d*(?:,\d+)*"
Upvotes: 3