I want to get all emails in a string and then replace them wrapped in a bold tag so I can then format the email addresses to make them bold.
I've managed to mostly get this working, however I am not able to get the same email back out again in my replace.
Can someone tell me what i'm doing wrong?
What I am after is this..
First email test@test.com second email test1@test1.com
what I am getting is this...
First email test. second email test1.
var text = "First email test@test.com second email test1@test1.com";
var regexp = /[\w-\.]+@([\w-]+\.)+[\w-]{2,4}/g
var text = text.replace(regexp, '<b>$1</b>');
console.log(text);