[Vuejs]-Replace string with symbol using javascript?

3👍

Use a regex replacement:

var input = "@abc some text here";
var output = input.replace(/(@\S+)/, "<a href=\"some_url\">$1</a>");
console.log(output);

Leave a comment