I have a JavaScript regex for email addresses:
/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
Fiddle here: https://regex101.com/r/8Z9ORb/1
Used in the .Validate plugin, this will allow test@test.com
but not test@test
and other bad email addresses.
But how can I allow this pattern to be repeated if comma separated? Ie, how can I allow:
While not allowing bad emails in the CSV or a bad CSV, like:
This seems to work? But I'm no regexpert.
/^((([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))+(,|, |$))*$/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.