我想去掉HTML中的从<到>中的内容,的正则表达式怎么写???

e800 2005-03-25 03:18:42
如题~~
我想去掉HTML中的从<到>中的内容,的正则表达式怎么写???
...全文
160 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
corbet 2005-03-27
  • 打赏
  • 举报
回复
顶回去!
wcmj 2005-03-25
  • 打赏
  • 举报
回复
不过要是
string strFilePath="q1<HTML lang=zh xml:lang='zh' xmlns='http://www.w3.org/1999/xhtml'>q2<HTML lang=zh xml:lang='zh' xmlns='http://www.w3.org/1999/xhtml'>12131";
就会输出q1<>12131
wcmj 2005-03-25
  • 打赏
  • 举报
回复
如楼上所说
junguo 2005-03-25
  • 打赏
  • 举报
回复
string strFilePath="<HTML lang=zh xml:lang='zh' xmlns='http://www.w3.org/1999/xhtml'>";
string strPatten = @"\<[\s|\S]*\>";
Regex re = new Regex(strPatten,RegexOptions.IgnoreCase);
string strFileName = re.Replace(strFilePath,"<>");
AKaiCSDN 2005-03-25
  • 打赏
  • 举报
回复
做个while循环,用两个substring截字符串吧,简单
e800 2005-03-25
  • 打赏
  • 举报
回复
楼上的,如果是这样:<HTML lang=zh xml:lang="zh" xmlns="http://www.w3.org/1999/xhtml">
你哪个就过滤不了吧?
junguo 2005-03-25
  • 打赏
  • 举报
回复
string strPatten = @"\<\S*\>";
Regex re = new Regex(strPatten,RegexOptions.IgnoreCase);
string strFileName = re.Replace(strFilePath,"\<\>");

试试这个!

110,534

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧