javascript replace string with exact match

i have bulk of email address in textarea ‘[email protected]@[email protected]@[email protected]’

what i want to do is add ‘comma space’ behind of .com /

expected result after onblur function in textarea: `[email protected], [email protected], [email protected], [email protected], [email protected], [email protected]

what i have tried.

b = value.split('').join(', ');
b = value.split('.com').join('.com, ');

problem : it will replace all ‘.com’ to ‘.com, ‘ even with ‘’


var value = "[email protected]@[email protected]@[email protected]";
value = value.replace(/(.com(.my)?)/gm, '$1, ');
console.log(value.substring(0, value.length - 2));