Validate a comma separated email list

前端 未结 5 1094
北恋
北恋 2021-01-04 11:00

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

5条回答
  •  天命终不由人
    2021-01-04 11:23

    I agree with @crisbeto's comment but if you are sure that this is how you want to do it, you can do it by matching the following regex:

    ^(\s?[^\s,]+@[^\s,]+\.[^\s,]+\s?,)*(\s?[^\s,]+@[^\s,]+\.[^\s,]+)$

提交回复
热议问题