javascript - Get an email from a string -
this question has answer here:
a newbie here
this problem
let string
var string = "this string contains many different words domain@gmail.com want email";
what want regex or different gets domain@gmail.com
i've tried many things none has worked
this last 1 i've tried
var myregexp = /@(.*)/; var match = myregexp.exec(string); if(match) console.log(match[1]);
this returns null or undefined
can me out
edit
i want search before , after @ , stops on blank space
thanks
emails = str.match(/(\s[^\s@]*@\s+)/gi)
Comments
Post a Comment