I have a regex which matches any combination of the number 1,7 and 99, separated by commas. E.g. these should be matched:
1
1,7
1,99
99,1,7
While these should not match:
1,
8
8,99
,7
1,7,99,
The following works fine, but can probably be shortened and made more efficient?
/^(1|7|99)(,?(1|7|99)(,?(1|7|99))?)?$/
Aucun commentaire:
Enregistrer un commentaire