大家好:
我把我的问题在说明一下,原帖在这里
http://topic.csdn.net/u/20100119/11/55ca661f-9f06-47f2-9075-5892cf928999.html?27715我说的不是很清楚,11#12#都解决了我的问题。我的意思是如果word文档里有表格样式就不去掉例子:
<P class=MsoNormal> <B style="mso-bidi-font-weight: normal"> <SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">一.项目需求说明: </SPAN> </B> <B style="mso-bidi-font-weight: normal"> <SPAN lang=EN-US style="mso-bidi-font-size: 10.5pt"> <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /> <o:p> </o:p> </SPAN> </B> </P>
<P class=a style="MARGIN: 6pt 0cm; TEXT-INDENT: 21pt; LINE-HEIGHT: 150%; mso-para-margin-top: .5gd; mso-para-margin-right: 0cm; mso-para-margin-bottom: .5gd; mso-para-margin-left: 0cm; mso-char-indent-count: 2.0"> <SPAN style="FONT-SIZE: 10.5pt; LINE-HEIGHT: 150%; mso-bidi-font-size: 10.0pt; mso-hansi-font-family: 宋体">本软件系统主要应用于市南区政府以及广大的人民群众,方便公众可以随时随地查看政策法规、审批事项等最新服务信息, </SPAN> <SPAN style="FONT-SIZE: 10.5pt; COLOR: black; LINE-HEIGHT: 150%; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial">更有效地缩短政府与民众间的距离 </SPAN> <SPAN style="FONT-SIZE: 10.5pt; LINE-HEIGHT: 150%; mso-bidi-font-size: 10.0pt; mso-hansi-font-family: 宋体">。 <SPAN lang=EN-US> <o:p> </o:p> </SPAN> </SPAN> </P>
<P class=a style="MARGIN: 6pt 0cm; LINE-HEIGHT: 150%; mso-para-margin-top: .5gd; mso-para-margin-right: 0cm; mso-para-margin-bottom: .5gd; mso-para-margin-left: 0cm"> <B style="mso-bidi-font-weight: normal"> <SPAN style="FONT-SIZE: 10.5pt; LINE-HEIGHT: 150%; mso-bidi-font-size: 10.0pt; mso-hansi-font-family: 宋体">二.技术需求说明: <SPAN lang=EN-US> <o:p> </o:p> </SPAN> </SPAN> </B> </P>
<P class=MsoNormal> <B style="mso-bidi-font-weight: normal"> <SPAN lang=EN-US style="mso-bidi-font-size: 10.5pt">2.1 </SPAN> </B> <B style="mso-bidi-font-weight: normal"> <SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">综合性能 </SPAN> </B> <SPAN lang=EN-US style="mso-bidi-font-size: 10.5pt"> <o:p> </o:p> </SPAN> </P>
<P class=MsoNormal style="TEXT-INDENT: 15.75pt; LINE-HEIGHT: 150%; mso-char-indent-count: 1.5"> <SPAN lang=EN-US style="LINE-HEIGHT: 150%; mso-bidi-font-size: 10.5pt">1) </SPAN> <SPAN style="LINE-HEIGHT: 150%; FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">要实现 </SPAN> <SPAN style="COLOR: black; LINE-HEIGHT: 150%; FONT-FAMILY: 宋体; mso-bidi-font-weight: bold; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: 'verdana,ˎ̥'; mso-hansi-font-family: 'verdana,ˎ̥'; mso-bidi-font-family: Arial">用户随时随地查看最新信息 </SPAN> <SPAN style="LINE-HEIGHT: 150%; FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">。 </SPAN> <SPAN lang=EN-US style="LINE-HEIGHT: 150%; mso-bidi-font-size: 10.5pt"> <o:p> </o:p> </SPAN> </P>
<P class=MsoNormal style="TEXT-INDENT: 15.75pt; LINE-HEIGHT: 150%; mso-char-indent-count: 1.5"> <SPAN lang=EN-US style="LINE-HEIGHT: 150%; mso-bidi-font-size: 10.5pt">2) </SPAN> <SPAN style="LINE-HEIGHT: 150%; FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">要实现手机和电脑同时访问。 </SPAN> <SPAN lang=EN-US style="LINE-HEIGHT: 150%; mso-bidi-font-size: 10.5pt"> <o:p> </o:p> </SPAN> </P>
<P class=MsoNormal style="TEXT-INDENT: 15.75pt; LINE-HEIGHT: 150%; mso-char-indent-count: 1.5"> <SPAN lang=EN-US style="LINE-HEIGHT: 150%; mso-bidi-font-size: 10.5pt">3) </SPAN> <SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">要实现快速查询的功能,只要输入相关主题的关键字就能十分轻松方便地找到您想要的信息。 </SPAN> </P>
<TABLE cellSpacing=0 cellPadding=0 border=1>
<TBODY>
<TR>
<TD vAlign=top width=189>
<DIV>分割各付各的</DIV></TD>
<TD vAlign=top width=189>
<DIV>是否</DIV></TD>
<TD vAlign=top width=189>
<DIV>地方</DIV></TD></TR>
<TR>
<TD vAlign=top width=189>
<DIV> 地方</DIV></TD>
<TD vAlign=top width=189>
<DIV>地方</DIV></TD>
<TD vAlign=top width=189>
<DIV> 地方</DIV></TD></TR>
<TR>
<TD vAlign=top width=189>
<DIV> 的地方</DIV></TD>
<TD vAlign=top width=189>
<DIV>地方</DIV></TD>
<TD vAlign=top width=189>
<DIV> 得分的</DIV></TD></TR></TBODY></TABLE>
我把我的问题在说明一下,原帖在这里
http://topic.csdn.net/u/20100119/11/55ca661f-9f06-47f2-9075-5892cf928999.html?27715我说的不是很清楚,11#12#都解决了我的问题。我的意思是如果word文档里有表格样式就不去掉例子:
<P class=MsoNormal> <B style="mso-bidi-font-weight: normal"> <SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">一.项目需求说明: </SPAN> </B> <B style="mso-bidi-font-weight: normal"> <SPAN lang=EN-US style="mso-bidi-font-size: 10.5pt"> <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /> <o:p> </o:p> </SPAN> </B> </P>
<P class=a style="MARGIN: 6pt 0cm; TEXT-INDENT: 21pt; LINE-HEIGHT: 150%; mso-para-margin-top: .5gd; mso-para-margin-right: 0cm; mso-para-margin-bottom: .5gd; mso-para-margin-left: 0cm; mso-char-indent-count: 2.0"> <SPAN style="FONT-SIZE: 10.5pt; LINE-HEIGHT: 150%; mso-bidi-font-size: 10.0pt; mso-hansi-font-family: 宋体">本软件系统主要应用于市南区政府以及广大的人民群众,方便公众可以随时随地查看政策法规、审批事项等最新服务信息, </SPAN> <SPAN style="FONT-SIZE: 10.5pt; COLOR: black; LINE-HEIGHT: 150%; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial">更有效地缩短政府与民众间的距离 </SPAN> <SPAN style="FONT-SIZE: 10.5pt; LINE-HEIGHT: 150%; mso-bidi-font-size: 10.0pt; mso-hansi-font-family: 宋体">。 <SPAN lang=EN-US> <o:p> </o:p> </SPAN> </SPAN> </P>
<P class=a style="MARGIN: 6pt 0cm; LINE-HEIGHT: 150%; mso-para-margin-top: .5gd; mso-para-margin-right: 0cm; mso-para-margin-bottom: .5gd; mso-para-margin-left: 0cm"> <B style="mso-bidi-font-weight: normal"> <SPAN style="FONT-SIZE: 10.5pt; LINE-HEIGHT: 150%; mso-bidi-font-size: 10.0pt; mso-hansi-font-family: 宋体">二.技术需求说明: <SPAN lang=EN-US> <o:p> </o:p> </SPAN> </SPAN> </B> </P>
<P class=MsoNormal> <B style="mso-bidi-font-weight: normal"> <SPAN lang=EN-US style="mso-bidi-font-size: 10.5pt">2.1 </SPAN> </B> <B style="mso-bidi-font-weight: normal"> <SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">综合性能 </SPAN> </B> <SPAN lang=EN-US style="mso-bidi-font-size: 10.5pt"> <o:p> </o:p> </SPAN> </P>
<P class=MsoNormal style="TEXT-INDENT: 15.75pt; LINE-HEIGHT: 150%; mso-char-indent-count: 1.5"> <SPAN lang=EN-US style="LINE-HEIGHT: 150%; mso-bidi-font-size: 10.5pt">1) </SPAN> <SPAN style="LINE-HEIGHT: 150%; FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">要实现 </SPAN> <SPAN style="COLOR: black; LINE-HEIGHT: 150%; FONT-FAMILY: 宋体; mso-bidi-font-weight: bold; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: 'verdana,ˎ̥'; mso-hansi-font-family: 'verdana,ˎ̥'; mso-bidi-font-family: Arial">用户随时随地查看最新信息 </SPAN> <SPAN style="LINE-HEIGHT: 150%; FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">。 </SPAN> <SPAN lang=EN-US style="LINE-HEIGHT: 150%; mso-bidi-font-size: 10.5pt"> <o:p> </o:p> </SPAN> </P>
<P class=MsoNormal style="TEXT-INDENT: 15.75pt; LINE-HEIGHT: 150%; mso-char-indent-count: 1.5"> <SPAN lang=EN-US style="LINE-HEIGHT: 150%; mso-bidi-font-size: 10.5pt">2) </SPAN> <SPAN style="LINE-HEIGHT: 150%; FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">要实现手机和电脑同时访问。 </SPAN> <SPAN lang=EN-US style="LINE-HEIGHT: 150%; mso-bidi-font-size: 10.5pt"> <o:p> </o:p> </SPAN> </P>
<P class=MsoNormal style="TEXT-INDENT: 15.75pt; LINE-HEIGHT: 150%; mso-char-indent-count: 1.5"> <SPAN lang=EN-US style="LINE-HEIGHT: 150%; mso-bidi-font-size: 10.5pt">3) </SPAN> <SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">要实现快速查询的功能,只要输入相关主题的关键字就能十分轻松方便地找到您想要的信息。 </SPAN> </P>
<TABLE cellSpacing=0 cellPadding=0 border=1>
<TBODY>
<TR>
<TD vAlign=top width=189>
<DIV>分割各付各的</DIV></TD>
<TD vAlign=top width=189>
<DIV>是否</DIV></TD>
<TD vAlign=top width=189>
<DIV>地方</DIV></TD></TR>
<TR>
<TD vAlign=top width=189>
<DIV> 地方</DIV></TD>
<TD vAlign=top width=189>
<DIV>地方</DIV></TD>
<TD vAlign=top width=189>
<DIV> 地方</DIV></TD></TR>
<TR>
<TD vAlign=top width=189>
<DIV> 的地方</DIV></TD>
<TD vAlign=top width=189>
<DIV>地方</DIV></TD>
<TD vAlign=top width=189>
<DIV> 得分的</DIV></TD></TR></TBODY></TABLE>
解决方案 »
- 急 求一种校内网首页新鲜事的思路
- 在线等,关于对出的问题。
- ASP .NET页面刷新时FileUpload重复提交
- 我想把文本文件日期的字符串读入数据库,怎么实现 谢谢!!!!
- [原创] 最近开发的智能采集软件 (支持图片验证码,连论坛的数据都能采集)
- 想请教高手们一个简单的关于遍历所有控件的问题!
- 访问带有 Pubs SQL Server 示例数据库的服务器。
- 绝对非广告,C#网络教学,完全免费,内详
- 我公司需要一ASP.NET高手,联系方式内祥
- "表头不动表体动",控件下载...含源码.来自2星用户(rickjelly2004),支持的进来UP!
- 关于ASP.NET2.0中使用事务,请给一个实例.
- ASP.NET 2.0 中JQuery的问题
替换成如下结果:
<br>一.项目需求说明:
<br>本软件系统主要应用于市南区政府以及广大的人民群众,方便公众可以随时随地查看政策法规、审批事项等最新服务信息,更有效地缩短政府与民众间的距离。
<br>二.技术需求说明:
<br>2.1综合性能
<br>1)要实现用户随时随地查看最新信息。
<br>2)要实现手机和电脑同时访问。
<br>3)要实现快速查询的功能,只要输入相关主题的关键字就能十分轻松方便地找到您想要的信息
<TABLE cellSpacing=0 cellPadding=0 border=1>
<TR>
<TD vAlign=top width=189>
分割各付各的 </TD>
<TD vAlign=top width=189>
是否</TD>
<TD vAlign=top width=189> 地方 </TD> </TR>
<TR>
<TD vAlign=top width=189>
地方 </TD>
<TD vAlign=top width=189>
地方 </TD>
<TD vAlign=top width=189>
地方 </TD> </TR>
<TR>
<TD vAlign=top width=189>
的地方 </TD>
<TD vAlign=top width=189>
地方 </TD>
<TD vAlign=top width=189>
nbsp;得分的 </TD> </TR></TABLE>
string str = " <P class=MsoNormal> <B style=\"mso-bidi-font-weight: normal\"> <SPAN style=\"FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'\">一.项目需求说明: </SPAN> </B> <B style=\"mso-bidi-font-weight: normal\"> <SPAN lang=EN-US style=\"mso-bidi-font-size: 10.5pt\"> <?xml:namespace prefix = o ns = \"urn:schemas-microsoft-com:office:office\" /> <o:p> </o:p> </SPAN> </B> </P> <P class=a style=\"MARGIN: 6pt 0cm; TEXT-INDENT: 21pt; LINE-HEIGHT: 150%; mso-para-margin-top: .5gd; mso-para-margin-right: 0cm; mso-para-margin-bottom: .5gd; mso-para-margin-left: 0cm; mso-char-indent-count: 2.0\"> <SPAN style=\"FONT-SIZE: 10.5pt; LINE-HEIGHT: 150%; mso-bidi-font-size: 10.0pt; mso-hansi-font-family: 宋体\">本软件系统主要应用于市南区政府以及广大的人民群众,方便公众可以随时随地查看政策法规、审批事项等最新服务信息, </SPAN> <SPAN style=\"FONT-SIZE: 10.5pt; COLOR: black; LINE-HEIGHT: 150%; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial\">更有效地缩短政府与民众间的距离 </SPAN> <SPAN style=\"FONT-SIZE: 10.5pt; LINE-HEIGHT: 150%; mso-bidi-font-size: 10.0pt; mso-hansi-font-family: 宋体\">。 <SPAN lang=EN-US> <o:p> </o:p> </SPAN> </SPAN> </P> <P class=a style=\"MARGIN: 6pt 0cm; LINE-HEIGHT: 150%; mso-para-margin-top: .5gd; mso-para-margin-right: 0cm; mso-para-margin-bottom: .5gd; mso-para-margin-left: 0cm\"> <B style=\"mso-bidi-font-weight: normal\"> <SPAN style=\"FONT-SIZE: 10.5pt; LINE-HEIGHT: 150%; mso-bidi-font-size: 10.0pt; mso-hansi-font-family: 宋体\">二.技术需求说明: <SPAN lang=EN-US> <o:p> </o:p> </SPAN> </SPAN> </B> </P> <P class=MsoNormal> <B style=\"mso-bidi-font-weight: normal\"> <SPAN lang=EN-US style=\"mso-bidi-font-size: 10.5pt\">2.1 </SPAN> </B> <B style=\"mso-bidi-font-weight: normal\"> <SPAN style=\"FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'\">综合性能 </SPAN> </B> <SPAN lang=EN-US style=\"mso-bidi-font-size: 10.5pt\"> <o:p> </o:p> </SPAN> </P> <P class=MsoNormal style=\"TEXT-INDENT: 15.75pt; LINE-HEIGHT: 150%; mso-char-indent-count: 1.5\"> <SPAN lang=EN-US style=\"LINE-HEIGHT: 150%; mso-bidi-font-size: 10.5pt\">1) </SPAN> <SPAN style=\"LINE-HEIGHT: 150%; FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'\">要实现 </SPAN> <SPAN style=\"COLOR: black; LINE-HEIGHT: 150%; FONT-FAMILY: 宋体; mso-bidi-font-weight: bold; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: 'verdana,ˎ̥'; mso-hansi-font-family: 'verdana,ˎ̥'; mso-bidi-font-family: Arial\">用户随时随地查看最新信息 </SPAN> <SPAN style=\"LINE-HEIGHT: 150%; FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'\">。 </SPAN> <SPAN lang=EN-US style=\"LINE-HEIGHT: 150%; mso-bidi-font-size: 10.5pt\"> <o:p> </o:p> </SPAN> </P> <P class=MsoNormal style=\"TEXT-INDENT: 15.75pt; LINE-HEIGHT: 150%; mso-char-indent-count: 1.5\"> <SPAN lang=EN-US style=\"LINE-HEIGHT: 150%; mso-bidi-font-size: 10.5pt\">2) </SPAN> <SPAN style=\"LINE-HEIGHT: 150%; FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'\">要实现手机和电脑同时访问。 </SPAN> <SPAN lang=EN-US style=\"LINE-HEIGHT: 150%; mso-bidi-font-size: 10.5pt\"> <o:p> </o:p> </SPAN> </P> <P class=MsoNormal style=\"TEXT-INDENT: 15.75pt; LINE-HEIGHT: 150%; mso-char-indent-count: 1.5\"> <SPAN lang=EN-US style=\"LINE-HEIGHT: 150%; mso-bidi-font-size: 10.5pt\">3) </SPAN> <SPAN style=\"FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'\">要实现快速查询的功能,只要输入相关主题的关键字就能十分轻松方便地找到您想要的信息。 </SPAN> </P> <TABLE cellSpacing=0 cellPadding=0 border=1> <TBODY> <TR> <TD vAlign=top width=189> <DIV>分割各付各的 </DIV> </TD> <TD vAlign=top width=189> <DIV>是否 </DIV> </TD> <TD vAlign=top width=189> <DIV>地方 </DIV> </TD> </TR> <TR> <TD vAlign=top width=189> <DIV> 地方 </DIV> </TD> <TD vAlign=top width=189> <DIV>地方 </DIV> </TD> <TD vAlign=top width=189> <DIV> 地方 </DIV> </TD> </TR> <TR> <TD vAlign=top width=189> <DIV> 的地方 </DIV> </TD> <TD vAlign=top width=189> <DIV>地方 </DIV> </TD> <TD vAlign=top width=189> <DIV> 得分的 </DIV> </TD> </TR> </TBODY> </TABLE> ";
str = Regex.Replace(str, @"<(p)[^>]*>", "</br>", RegexOptions.IgnoreCase);
str = Regex.Replace(str, @"<(?!/?table)(?!/?tbody)(?!/?tr)(?!/?td)(?!/?br)[^>]*>", "", RegexOptions.IgnoreCase);
Response.Write(str);
给分。。
这样也是可以的谁能给我解释一下
(?!/?table\b)遇见<table></table>不匹配
(?!/?tr\b)遇见<tr></tr>的不匹配
(?!/?td\b)遇见<td></td>的不匹配
把[^>]*去掉
[^>]*就是取所有的字符,直到>为止
(?i) <(?!/?table\b)(?!/?tr\b)(?!/?td\b)[^>]*>
我想知道,红字部分是什么意思????
(?!exp) 匹配后面跟的不是exp的位置
/?就是说/可有可无
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Linq.Expressions;
using System.Data;
using System.IO;namespace ConsoleApplication11
{
class Program
{
static void Main(string[] args)
{
string str = @"<TABLE cellSpacing=0 cellPadding=0 border=1>
<TBODY>
<TR>
<TD vAlign=top width=189>
<DIV>分割各付各的 </DIV> </TD>
<TD vAlign=top width=189>
<DIV>是否 </DIV> </TD>
<TD vAlign=top width=189>
<DIV>地方 </DIV> </TD> </TR>
<TR>
<TD vAlign=top width=189>
<DIV> 地方 </DIV> </TD>
<TD vAlign=top width=189>
<DIV>地方 </DIV> </TD>
<TD vAlign=top width=189>
<DIV> 地方 </DIV> </TD> </TR>
<TR>
<TD vAlign=top width=189>
<DIV> 的地方 </DIV> </TD>
<TD vAlign=top width=189>
<DIV>地方 </DIV> </TD>
<TD vAlign=top width=189>
<DIV> 得分的 </DIV> </TD> </TR> </TBODY> </TABLE> ";
Regex re = new Regex(@"(?i)<(?!/?table\b)(?!/?tr\b)(?!/?td\b)>");
Console.WriteLine(re.Replace(str,""));
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Linq.Expressions;
using System.Data;
using System.IO;namespace ConsoleApplication11
{
class Program
{
static void Main(string[] args)
{
string str = @"<P class=MsoNormal style=""TEXT-INDENT: 15.75pt; LINE-HEIGHT: 150%; mso-char-indent-count: 1.5""> <SPAN lang=EN-US style=""LINE-HEIGHT: 150%; mso-bidi-font-size: 10.5pt"">3) </SPAN> <SPAN style=""FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"">要实现快速查询的功能,只要输入相关主题的关键字就能十分轻松方便地找到您想要的信息。 </SPAN> </P><TABLE cellSpacing=0 cellPadding=0 border=1>
<TBODY>
<TR>
<TD vAlign=top width=189>
<DIV>分割各付各的 </DIV> </TD>
<TD vAlign=top width=189>
<DIV>是否 </DIV> </TD>
<TD vAlign=top width=189>
<DIV>地方 </DIV> </TD> </TR>
<TR>
<TD vAlign=top width=189>
<DIV> 地方 </DIV> </TD>
<TD vAlign=top width=189>
<DIV>地方 </DIV> </TD>
<TD vAlign=top width=189>
<DIV> 地方 </DIV> </TD> </TR>
<TR>
<TD vAlign=top width=189>
<DIV> 的地方 </DIV> </TD>
<TD vAlign=top width=189>
<DIV>地方 </DIV> </TD>
<TD vAlign=top width=189>
<DIV> 得分的 </DIV> </TD> </TR> </TBODY> </TABLE> ";
Regex re = new Regex(@"(?i)<(?!/?table\b)(?!/?tr\b)(?!/?td\b)[^>]*>");
Console.WriteLine(re.Replace(str,""));
}
}
}要加上[^>]*替换才可以满足你的要求
捕获 (exp) 匹配exp,并捕获文本到自动命名的组里
(?<name>exp) 匹配exp,并捕获文本到名称为name的组里,也可以写成(?'name'exp)
(?:exp) 匹配exp,不捕获匹配的文本,也不给此分组分配组号
零宽断言 (?=exp) 匹配exp前面的位置
(?<=exp) 匹配exp后面的位置
(?!exp) 匹配后面跟的不是exp的位置
(?<!exp) 匹配前面不是exp的位置
注释 (?#comment) 这种类型的分组不对正则表达式的处理产生任何影响,用于提供注释让人阅读
红字部分不是很理解 能举个例子吗??谢谢 今天刚看正则