This topic has been archived. It cannot be replied.
-
工作学习 / 专业技术讨论 / 有一些HTML Code,想去掉里面的HTML tag,只要留文本, 用c#+.net 1.1怎么写。谢谢。
-dzhu(Daniel);
2006-7-18
(#3086584@0)
-
try this in c#:string strHtmlCode = "<html><body width=123>test</body></html>";
Regex r = new Regex("<[^<>]+>");
foreach(Match m in r.Matches(strHtmlCode))
strHtmlCode = strHtmlCode.Replace(m.ToString(),"");
Response.Write(strHtmlCode);
A good site about regex:
http://www.regular-expressions.info/quickstart.html
-flowriver(iLinkTech.ca);
2006-7-19
{331}
(#3089268@0)
-
not only about regex, how about this one "<body>Professor wrote, <b>0<1, 2>1</b></body>"
-alittleman(凡人);
2006-7-19
(#3089885@0)
-
这个能正确显示吗?要是<>才行吧?
-remember_me_not(r-m-n);
2006-7-19
(#3090312@0)
-
Good point. So the user need define a better regular expression.
-flowriver(iLinkTech.ca);
2006-7-21
(#3095024@0)
-
try this, I used C#2.0, but easy to switch
-binghongcha76(一只大猫);
2006-7-21
{700}
(#3094045@0)