I am trying to replace a string like:
var str = "@xxx test@xxx.com"
by a new string contains HTML like:
<a href>@xxx</a> test@xxx.com
I tried to this way to replace but not correct:
str = str.replace(/@xxx/g, "<a href>@xxx</a>")
With this way, it will return HTML like:
<a href>@xxx</a> test<a href>@xxx</a>.com
I just want to replace whole word "@xxx". How can I do that?