高分相送,html代码替换问题
我用在线编辑器粘贴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
html = html.replace(/ /, " " );
// 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



