正则表达式,替换所有HTML标签的简单实例
(编辑:jimmy 日期: 2025/11/8 浏览:3 次 )
我自己写了一个正则表达式,<(.|\n)+"htmlcode">
public static string formatString(string str, int size)
{
string temp = str;
Regex regex = new Regex("<.+");
temp = regex.Replace(str, "");
temp = temp.Replace("\r\n", "");
temp = temp.Replace(" ", "");
if (temp.Length >= size)
{
temp = temp.Substring(0, size - 3) + " ";
}
return temp;
}
以上这篇正则表达式,替换所有HTML标签的简单实例就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持。
下一篇:基于slideout.js实现移动端侧边栏滑动特效