Replace Anchor Text with Angular NgClick

Run Settings
LanguageJavaScript
Language Version
Run Command
var string = "Thanks a lot <a href='https://glot.io'>glot.io</a>. You're awesome. Thanks a lot <a href=\"https://glot.io\">glot.io</a>. You're awesome. Thanks a lot <a href='glot.io'>glot.io</a>. You're awesome"; var regex = /<a([^>]*?)href\s*=\s*(['"])([^\2]*?)\2\1*>([^>]*?)<\/a>/gmi; // thanks to https://stackoverflow.com/a/40887021/4324393 var replace = string.replace(regex, function(full, group1, group2, group3, group4) { // thanks to https://stackoverflow.com/a/21711130/4324393 var result = full.replace(full, "<span ng-click=\"openLink('" + group3 + "')\">" + group4 + "</span>"); return result; }); console.log(replace);
Editor Settings
Theme
Key bindings
Full width
Lines