<script type="text/javascript">
String.prototype.stripHTML = function() {
var reTag = /<(?:.|/s)*?>/g;
return this.replace(reTag,"");
}
var sTest = "<b>this would be bold</b>";
alert(sTest.stripHTML());
</script>
<body>
</body>
?:非捕获性分组,不会创建反向引用,无需存储结果的开销。
尖括号 之间的内容不重要
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/tech/pnotes/8784.html