Could you tell me how to write this regular expression, JavaScript?


xxx@163.com,xxx@qq.com,xxx@xxxxx,xxx@xxxx,.....

there will be multiple mailboxes. I only need to check the @ symbol and the English comma at the end of the mailbox. I don"t check anything else. How do I write this rule

?
Mar.30,2021

regular mailbox

^[A-Za-z0-9\u4e00-\u9fa5]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$

the whole code:

const emails = 'xxx@163.com,xxx@qq.com,xxx@xxxxx,xxx@xxxx,.....';
const reg = /^[A-Za-z0-9\u4e00-\u9fa5]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/;
emails.split(',').forEach(email => {
    if (reg.test(email)) {
        console.log('')
    } else {
        console.log('')
    }
})

PS: bug

if English half-width commas are allowed in the mailbox.
/^([^,@]+@[^,@]+?)(,([^,@]+@[^,@]+?))*$/g
Menu