How to validate multiple emails using Regex?

后端 未结 3 1725
心在旅途
心在旅途 2021-01-13 16:02

After a quick research on the Stackoverflow, I wasn\'t able to find any solution for the multiple email validation using regex (split JS function is not applicable, but some

3条回答
  •  粉色の甜心
    2021-01-13 16:49

    There is no reason not to use split - in the same way the backend will obviously do.

    return str.split(/;\s*/).every(function(email) {
        return /.../.test(email);
    }
    

    For good or not-so-good email regular expressions have a look at Validate email address in JavaScript?.

提交回复
热议问题