[Javascript] js使用正则去除所有html标签([JavaScript] JS uses regular to remove all HTML tags)-html
[Javascript] js使用正则去除所有html标签([JavaScript] JS uses regular to remove all HTML tags)
直接使用正则表达式去掉字符串中的html标签
很简单的函数
function replaceHtml(str){
return str.replace(/<\/?.+?\/?>/g,'');
}
————————
Use regular expressions directly to remove HTML tags from strings
Very simple function
function replaceHtml(str){
return str.replace(/<\/?.+?\/?>/g,'');
}