I have a string that looks like this,
Joe Bloggs created the {project}Joe Project 1{/project} and created the brief {object}Brief Number 1{/object}
I want to turn this into a string of HTML that would looks like this,
Joe Bloggs created the <a href="" class="project-link">Joe Project 1</a> and created the brief <a href="" class="object-link">Brief Number 1</a>
I know I can do this,
var string = "Joe Bloggs created the {project}Joe Project 1{/project} and created the brief {object}Brief Number 1{/object}";
string.replace("{project}", "<a href='' class='project-link'>");
string.replace("{/project}", "</a>");
string.replace("{object}", "<a href='' class='object-link'>");
string.replace("{/object}", "</a>");
This does not feel particularly succinct though, is there a nicer way of doing this?