Reputation: 163
I've found following regex that can validate multiple email addresses (comma separated)
/^(\s?[^\s,]+@[^\s,]+\.[^\s,]+\s?,)*(\s?[^\s,]+@[^\s,]+\.[^\s,]+)$/
I also have this regex that can check for valid Indian mobile numbers, ie. 10 digit numeric starting with [6,7,8 or 9] only
/[6-9]{1}\d{9}/
I am looking for a regex that can test a comma separated list of mobile numbers.
let mobilePattern = /[6-9]{1}\d{9}/;
console.log(mobilePattern.test('8223822382')); // valid
console.log(mobilePattern.test('3223822382')); // invalid start with 3
console.log(mobilePattern.test('823822382')); // invalid 9 digits
Upvotes: 0
Views: 334
Reputation: 142
Yo can try with this:
/[6-9]\d{9}(,[6-9]\d{9})*/
If you wants that contains exactly that format you can try:
/^[6-9]\d{9}(,[6-9]\d{9})*$/
Upvotes: 3