I am using this regex to match email addresses in a string.
Everything works fine here: http://regexr.com?31e5a
with this regex:
([w-.]+)@((?:[w]+.)+)([a-zA-Z]{2,4})
But when I am trying to use it with javascript, I am getting only the first email address, not all of them.
Here is my code:
var emailsString = '[email protected] xxxxxxx [email protected]';
var emails = emailsString.match(/([w-.]+)@((?:[w]+.)+)([a-zA-Z]{2,4})/)[0];
Ad here, I am getting only the first email.
If you can help me, thank you.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…