87,989
社区成员
发帖
与我相关
我的任务
分享
var str = '<a class=\"fb\" href=\"/Event/Content/8811986d-d62b-c235-841a-08ce619dfb3c\">测试标题1</a><a class=\"fb\" href=\"/Event/Content/8811986d-d62b-c235-841a-08ce619dfb3c\">测试标题2</a>'
var high = '1';
var re = /[^>]+>(.+?)<[^<]+/gi;
re.test(str);
str = str.replace(re, function($){
return $.replace((RegExp.$1), (RegExp.$1).replace(high, '<span class="red">'+high+'</span>'))
})
alert(str)