测试字符串是:
hello hello hello
<span class="self-reference">Tom</span> I don't know <span class="self-reference">Tom</span> I don't think.
我希望成为:
hello hello hello
@Tom I don't know @Tom I don't think.
我使用这个正则表达式:
comment = comment.replace(/\<span class="self-reference"\>(.*)\<\/span\>/gi,"@$1");
但它输出:
hello hello hello
@Tom</span> I don't know <span class="self-reference">Tom I don't think.
谁能告诉我如何修改它以使其按预期工作?