I'm trying to come up with a regular expression to validate a comma separated email list.
I would like to validate the complete list in the first place, then split(";"), then trim each array value (each email) from the split.
I would like to validate the following expressions:
EMAIL,EMAIL --> Ok
EMAIL, EMAIL --> Ok
EMAIL , EMAIL --> Ok
EMAIL , , EMAIL --> Wrong
EMAIL , notAnEmail , EMAIL --> Wrong
I know there's many complex expressions for validating emails but I don't need anything fancy, this just works for me: /S+@S+.S+/;
I would like plain and simple JS, not jQuery. Thanks.
Edit: I've already considered fist validate then split, but with the expressions I've tried so far, this will be validated as two correct emails:
EMAIL, EMAIL . EMAIL
I would like to validate the list itself as much as every email.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…