CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
英特尔®游戏设计大赛100美元现金周周送 专题改版:Java Web 专题
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  .NET技术 >  ASP.NET

高分相送,html代码替换问题

楼主szjia345(szj)2003-09-01 12:43:07 在 .NET技术 / ASP.NET 提问

我用在线编辑器粘贴word文件时,生成的代码太大,在FCKeditor中方法:  
  html   =   html.replace(/<\/?SPAN[^>]*>/gi,   ""   );  
  //   Remove   Class   attributes  
  html   =   html.replace(/<(\w[^>]*)   class=([^   |>]*)([^>]*)/gi,   "<$1$3")   ;  
  //   Remove   Style   attributes  
  html   =   html.replace(/<(\w[^>]*)   style="([^"]*)"([^>]*)/gi,   "<$1$3")   ;  
  //   Remove   Lang   attributes  
  html   =   html.replace(/<(\w[^>]*)   lang=([^   |>]*)([^>]*)/gi,   "<$1$3")   ;  
  //   Remove   XML   elements   and   declarations  
  html   =   html.replace(/<\\?\?xml[^>]*>/gi,   "")   ;  
  //   Remove   Tags   with   XML   namespace   declarations:   <o:p></o:p>  
  html   =   html.replace(/<\/?\w+:[^>]*>/gi,   "")   ;  
  //   Replace   the   &nbsp;  
  html   =   html.replace(/&nbsp;/,   "   "   );  
  //   Transform   <P>   to   <DIV>  
  var   re   =   new   RegExp("(<P)([^>]*>.*?)(<\/P>)","gi")   ; //   Different   because   of   a   IE   5.0   error  
  html   =   html.replace(   re,   "<div$2</div>"   )   ;  
   
  不知如何用vb改写,用  
  html   =   replace(html,/<(\w[^>]*)   class=([^   |>]*)([^>]*)/gi,   "<$1$3")   )出错  
  问题点数:0、回复次数:2Top

1 楼saucer(思归)回复于 2003-09-01 12:54:06 得分 0

try  
   
  sHTML   =   System.Text.RegularExpressions.Regex.Replace(sHTML,   "<(\w[^>]*)   class=([^   |>]*)([^>]*)",   "<$1$3",   RegexOptions.IgnoreCase   Or   RegexOptions.Singleline)Top

2 楼alphawin(云和山的彼端)回复于 2003-09-01 13:10:06 得分 0

upTop

相关问题

  • 如何替换HTML源代码中的一部分字符串
  • 怎样替换Html文件中的某些代码呢?
  • 如何替换html代码中的字符串,
  • UBB 代码正则替换问题(500分)
  • 100分求教如何看到编译后被宏替换的代码?
  • 高分求源代码:PHP写的将提交上来的文章中的危险代码替换或支除的源代码
  • dw中怎样使用通配符?我想替换许多页面基本相似的html代码。
  • servlet中怎么实现java代码和html代码的分离????
  • 求在html代码中取出文本的代码,高分
  • 谁有替换的源代码?

关键词

  • 代码
  • html
  • gi
  • replace
  • remove
  • re

得分解答快速导航

  • 帖主:szjia345

相关链接

  • CSDN .NET频道
  • .NET类图书
  • C#类图书
  • .NET类源码下载

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
世纪乐知(北京)网络技术有限公司 版权所有, 京 ICP 证 020026 号
北京创新乐知广告有限公司 提供技术支持
Copyright © 2000-2007, CSDN.NET, All Rights Reserved
GongshangLogo