首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

在正则表达式~

2012-01-14 
在求一个正则表达式~~SPANstyle FONT-SIZE:12ptFONT-FAMILY:宋体 补出下列句子中省略的主语: BR

在求一个正则表达式~~
<SPAN   style= "FONT-SIZE:   12pt;   FONT-FAMILY:   宋体 "> 补出下列句子中省略的主语: <BR> <SPAN   lang=EN-US   style= "FONT-SIZE:   12pt;   FONT-FAMILY:   宋体;   mso-font-kerning:   1.0pt;   mso-bidi-font-family:   'Times   New   Roman ';   mso-ansi-language:   EN-US;   mso-fareast-language:   ZH-CN;   mso-bidi-language:   AR-SA "> <BR> 1 </SPAN> <SPAN   style= "FONT-SIZE:   12pt;   FONT-FAMILY:   宋体;   mso-font-kerning:   1.0pt;   mso-bidi-font-family:   'Times   New   Roman ';   mso-ansi-language:   EN-US;   mso-fareast-language:   ZH-CN;   mso-bidi-language:   AR-SA "> 、  
<DIV   id=fill_empty1   style= "DISPLAY:   inline;   FONT-SIZE:   12px;   WIDTH:   70px;   BORDER-BOTTOM:   #3300ff   1px   solid;   FONT-FAMILY:   宋体;   HEIGHT:   15px "   ms_positioning= "FlowLayout "   ;align= "left "> <SPAN   style= "FONT-SIZE:   12pt;   FONT-FAMILY:   宋体;   mso-font-kerning:   1.0pt;   mso-bidi-font-family:   'Times   New   Roman ';   mso-ansi-language:   EN-US;   mso-fareast-language:   ZH-CN;   mso-bidi-language:   AR-SA "> 渔人 </SPAN> </DIV> <SPAN   style= "FONT-SIZE:   12pt;   FONT-FAMILY:   宋体;   mso-font-kerning:   1.0pt;   mso-bidi-font-family:   'Times   New   Roman ';   mso-ansi-language:   EN-US;   mso-fareast-language:   ZH-CN;   mso-bidi-language:   AR-SA "> 便舍船,从口入。  
<DIV   id=fill_empty2   style= "DISPLAY:   inline;   FONT-SIZE:   12px;   WIDTH:   70px;   BORDER-BOTTOM:   #3300ff   1px   solid;   FONT-FAMILY:   宋体;   HEIGHT:   15px "   ms_positioning= "FlowLayout "   ;align= "left "> <SPAN   style= "FONT-SIZE:   12pt;   FONT-FAMILY:   宋体;   mso-font-kerning:   1.0pt;   mso-bidi-font-family:   'Times   New   Roman ';   mso-ansi-language:   EN-US;   mso-fareast-language:   ZH-CN;   mso-bidi-language:   AR-SA "> 山洞 </SPAN> </DIV> <SPAN   style= "FONT-SIZE:   12pt;   FONT-FAMILY:   宋体;   mso-font-kerning:   1.0pt;   mso-bidi-font-family:   'Times   New   Roman ';   mso-ansi-language:   EN-US;   mso-fareast-language:   ZH-CN;   mso-bidi-language:   AR-SA "> 初极狭,才通人。 <BR> </SPAN> </SPAN> </SPAN> <SPAN   lang=EN-US> <?xml:namespace   prefix   =   o   ns   =   "urn:schemas-microsoft-com:office:office "   /> <o:p> <SPAN   lang=EN-US   style= "FONT-SIZE:   12pt;   FONT-FAMILY:   宋体;   mso-font-kerning:   1.0pt;   mso-bidi-font-family:   'Times   New   Roman ';   mso-ansi-language:   EN-US;   mso-fareast-language:   ZH-CN;   mso-bidi-language:   AR-SA "> <BR> 2 </SPAN> <SPAN   style= "FONT-SIZE:   12pt;   FONT-FAMILY:   宋体;   mso-font-kerning:   1.0pt;   mso-bidi-font-family:   'Times   New   Roman ';   mso-ansi-language:   EN-US;   mso-fareast-language:   ZH-CN;   mso-bidi-language:   AR-SA "> 、  
<DIV   id=fill_empty3   style= "DISPLAY:   inline;   FONT-SIZE:   12px;   WIDTH:   70px;   BORDER-BOTTOM:   #3300ff   1px   solid;   FONT-FAMILY:   宋体;   HEIGHT:   15px "   ms_positioning= "FlowLayout "   ;align= "left "> <SPAN   style= "FONT-SIZE:   12pt;   FONT-FAMILY:   宋体;   mso-font-kerning:   1.0pt;   mso-bidi-font-family:   'Times   New   Roman ';   mso-ansi-language:   EN-US;   mso-fareast-language:   ZH-CN;   mso-bidi-language:   AR-SA "> 他们 </SPAN> </DIV> <SPAN   style= "FONT-SIZE:   12pt;   FONT-FAMILY:   宋体;   mso-font-kerning:   1.0pt;   mso-bidi-font-family:   'Times   New   Roman ';   mso-ansi-language:   EN-US;   mso-fareast-language:   ZH-CN;   mso-bidi-language:   AR-SA "> 见渔人,乃大惊,问所从来。  


<DIV   id=fill_empty5   style= "DISPLAY:   inline;   FONT-SIZE:   12px;   WIDTH:   70px;   BORDER-BOTTOM:   #3300ff   1px   solid;   FONT-FAMILY:   宋体;   HEIGHT:   15px "   ms_positioning= "FlowLayout "   ;align= "left "> <SPAN   style= "FONT-SIZE:   12pt;   FONT-FAMILY:   宋体;   mso-font-kerning:   1.0pt;   mso-bidi-font-family:   'Times   New   Roman ';   mso-ansi-language:   EN-US;   mso-fareast-language:   ZH-CN;   mso-bidi-language:   AR-SA "> 渔人 </SPAN> </DIV> <SPAN   style= "FONT-SIZE:   12pt;   FONT-FAMILY:   宋体;   mso-font-kerning:   1.0pt;   mso-bidi-font-family:   'Times   New   Roman ';   mso-ansi-language:   EN-US;   mso-fareast-language:   ZH-CN;   mso-bidi-language:   AR-SA "> 具答之。  
<DIV   id=fill_empty6   style= "DISPLAY:   inline;   FONT-SIZE:   12px;   WIDTH:   70px;   BORDER-BOTTOM:   #3300ff   1px   solid;   FONT-FAMILY:   宋体;   HEIGHT:   15px "   ms_positioning= "FlowLayout "   ;align= "left "> <SPAN   style= "FONT-SIZE:   12pt;   FONT-FAMILY:   宋体;   mso-font-kerning:   1.0pt;   mso-bidi-font-family:   'Times   New   Roman ';   mso-ansi-language:   EN-US;   mso-fareast-language:   ZH-CN;   mso-bidi-language:   AR-SA "> 他们 </SPAN> </DIV> <SPAN   style= "FONT-SIZE:   12pt;   FONT-FAMILY:   宋体 "> 便要还家,设酒杀鸡作食。 <SPAN   lang=EN-US> <o:p> </o:p> </SPAN> </SPAN> </SPAN> </SPAN> </SPAN> </o:p> </SPAN> </SPAN>


——————————————————————————————
得出 <div> 标记之间的属性内容   不要 </div>
例替换结果:

<DIV   id=fill_empty5   style= "DISPLAY:   inline;   FONT-SIZE:   12px;   WIDTH:   70px;   BORDER-BOTTOM:   #3300ff   1px   solid;   FONT-FAMILY:   宋体;   HEIGHT:   15px "   ms_positioning= "FlowLayout "   ;align= "left ">

<DIV   id=fill_empty6   style= "DISPLAY:   inline;   FONT-SIZE:   12px;   WIDTH:   70px;   BORDER-BOTTOM:   #3300ff   1px   solid;   FONT-FAMILY:   宋体;   HEIGHT:   15px "   ms_positioning= "FlowLayout "   ;align= "left ">




[解决办法]
try

string yourStr = ...........;
MatchCollection mc = Regex.Matches(yourStr, @ " <div[^> ]*> ", RegexOptions.IgnoreCase);
foreach (Match m in mc)
{
richTextBox2.Text += m.Value + "\n ";
}
[解决办法]
做循环好了
遍历 page 里的控件,然后再遍历属性
[解决办法]
var controls = document.getElementsByTagName( "div ");
for(var i = 0; i < controls.length; i ++
{
........
}

热点排行