js正则替换replace

content = "<p><strong>发斯蒂芬斯</strong>蒂芬434324</p><p><strong>范德萨发</strong>的发斯蒂芬</p><p><strong>242<b>3423</b>423</strong></p>";
console.log(content);
var pattern = /([\u4e00-\u9fa5]|[^<>])+(<[^>]+>)+([\u4e00-\u9fa5]|[^<>])+(<[^>]+>)/g;
content = content.replace(pattern,function($1){console.log($1);return $1.replace(/<[^>/]+>/g,'')});//替换不规范文本
console.log(content);

 

posted on 2016-11-09 17:59  小乔流水人家  阅读(1409)  评论(0编辑  收藏  举报

导航