网络编程 发布日期:2025/11/12 浏览次数:1
我自己写了一个正则表达式,<(.|\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标签的简单实例就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持。