1,978
社区成员
发帖
与我相关
我的任务
分享
/// <summary>
/// html代码替换
/// </summary>
/// <param name="strContent"></param>
/// <returns></returns>
public static string ReplaceHtmlCode(string strContent)
{
string text1 = @"\<[^\<,\>]+\>";
Regex regex1 = new Regex(text1, RegexOptions.Singleline | RegexOptions.Compiled | RegexOptions.IgnoreCase);
MatchCollection collection1 = regex1.Matches(strContent);
for (int num1 = 0; num1 < collection1.Count; num1++)
{
strContent = strContent.Replace(collection1[num1].Value, "");
}
return strContent;
}
string s = " <td valign=\"top\" style=\"font-size: 10.5pt;\"> <strong> SMART & BIGGAR";
string result = Regex.Replace(s, "<[^>]*>", "");
string str="<td valign=\"top\" style=\"font-size: 10.5pt;\"> <strong> SMART & BIGGAR";
string a = System.Text.RegularExpressions.Regex.Replace(str,@"<td valign=""top"" style=""font-size: 10.5pt;""> <strong>(.*?)","$1");
Response.Write(a);