我的后台编译后的代码:<P style="TEXT-INDENT: 21pt; MARGIN: 0cm 0cm 0pt; mso-char-indent-count: 2.0"><FONT size=3><SPAN lang=EN-US><FONT face="Times New Roman">Visual C++ 6</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">有许多</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Microsoft</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">对</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Windows</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的特定扩展
我的C#代码:
if (content.ContentDetail.Length > Length)
{
Regex pattern = new Regex("[\u4e00-\u9fa5]|[\uFE30-\uFFA0]|[_\a-zA-Z0-9]");
StringBuilder builer = new StringBuilder();
MatchCollection collection = pattern.Matches(content.ContentDetail);
foreach (Match m in collection)
{
builer.Append(m.ToString());
}
但是不行
我只想把尖括号和尖括号里面的内容去掉
请高手指点下,谢谢!
using System.Text.RegularExpressions;
public static string striphtml(string strhtml)
{
string stroutput = strhtml;
Regex regex = new Regex(@"<[^>]+>|</[^>]+>"); copyright lyttzx.com
stroutput = regex.Replace(stroutput, "");
return stroutput; lyttzx.com
}
网上搜到的。
地址:http://www.lyttzx.com/plus/view.php?aid=4127
Regex.Replace(content, @"<[^>]*>", string.Empty, RegexOptions.Compiled);