问题
I am looking for a regular expression which accepts comma separated values(no space) of both string and numbers(especially mobile numbers, 10 digits) for client side validation.
I have gone through regexlib.com but i couldn't find good one.
UPDATE
Input patterns:
9655770780,college,8095145098,schoolmates
Its a just a input field, users can enter group name of mobile numbers or just the numbers.
Any suggestions!
回答1:
Regular expressions may be overkill for this problem.
You could use:
var csv_values = csv_string.split(",");
This would split on the commas and give you your values
回答2:
Try this pattern. This will verify if a text is a comma separated
([a-zA-Z0-9]+,)+
来源:https://stackoverflow.com/questions/4733319/regex-to-match-comma-separated-values