I have a text area and a user can input US zip codes in it separated by a comma or (comma and space).
It could be like 12345,45678, 89654
The following regex i
You can use:
var s='12345,45678, 12345'; var m = s.match(/^(?:\d{5},\s?)*\d{5}$/);