替换HTML代码

   //删除脚本
   content = content.replace(/<script[^>]*>(.|/s)*</script>/ig,"");
   
   //<....>
   content = content.replace(/<(.|/n)+?>/ig);
 
   //删除HTML
   //<....>
   content = content.replace(/<(.[^>]*)>/ig, "");
   content = content.replace(/([/r/n])[/s]+/ig, "");
   content = content.replace(/-->/ig, "");
   content = content.replace(/<!--.*/ig, "");
   content = content.replace(/&(quot|#34);/ig, "/"");
   content = content.replace(/&(amp|#38);/ig, "&");
   content = content.replace(/&(lt|#60);/ig, "<");
   content = content.replace(/&(gt|#62);/ig, ">");
   content = content.replace(/&(nbsp|#160);/ig, " ");
   content = content.replace(/&(iexcl|#161);/ig, "/xa1");
   content = content.replace(/&(cent|#162);/ig, "/xa2");
   content = content.replace(/&(pound|#163);/ig, "/xa3");
   content = content.replace(/&(copy|#169);/ig, "/xa9");
   content = content.replace(/</ig, "");
   content = content.replace(/>/ig, "");
   content = content.replace(//r/n/ig, "");

©️2020 CSDN 皮肤主题: 大白 设计师: CSDN官方博客 返回首页
实付0元
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值