Test string is:
hello hello hello
<span class="self-reference">Tom</span> I don't know <span class="self-reference">Tom</span> I don't think.
I wish to to come out as:
hello hello hello
@Tom I don't know @Tom I don't think.
I use this regex:
comment = comment.replace(/\<span class="self-reference"\>(.*)\<\/span\>/gi,"@$1");
But it outputs:
hello hello hello
@Tom</span> I don't know <span class="self-reference">Tom I don't think.
Can anyone tell me how to modify this so it works as expected?