求一正则表达式

yrf741676206 2011-11-24 10:33:39
detail b ----------------------------->
<TABLE WIDTH="100%" BORDER="0" ALIGN="center" CELLPADDING="1" CELLSPACING="1">
<TR>
<TD ><!--【<B>
<'% = rs2("prename") %> <font class="fontpur">
</B>】--><font class="fontpur">SGL-BBD23</font></TD>
</TR>
<TR>
<TD height=2>
<hr size="1" class="h1">
</TD>
</TR>
<TR>
<TD >【<B>
Item No. <!--% = rs2("intro") %-->
</B>】SGL-BBD23</TD>
</TR>
<TR>
<TD>【<B>
Product Name: <!--% = rs2("company") %-->
</B>】<a href=timesmark.asp?MarkName=Built-In Bulbs Series><font color="#B0361A">
Built-In Bulbs Series
</font></a></TD>
</TR>
<tr><td height="5"> </td></tr>
<tr>
<td><h1>
Thanks for your interested in our products, <br>
if you have special needs in your lighting project, <br>
please feel free let us know. <br>
<br>
We can make custom design product for you.<br>
Or just let us know more idea about your project,<br>
we can full fill your idea come true.<br>
<br>
Waiting for your email.<br>
Everything is possible!!!
</h1> </td>
</tr>
</TABLE>
</TD>
</TR>
</TABLE>
从以上代码中用正则获取:SGL-BBD23 和item No.后面的 SGL-OT241 和 Built-In Bulbs Series

拜求大神
...全文
78 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
wushuai1346 2011-11-24
  • 打赏
  • 举报
回复
先贴一个,马上再优化
@"<TABLE[^>]*?>(?:\s*<[^>]*?>\s*)*(?:<!--(?:(?!-->)[^^])*?-->)*<font[^>]*?>(?'product'[^<>]*?)</font></TD>(?#...
...)(?:\s*<[^>]*?>\s*)*【[^】]*?】(?'number'[^<>]*?)</TD>(?:\s*<[^>]*?>\s*)*【[^】]*?】(?#.....)<a[^>]*?><font[^>]*?>(?'name'[^<>]*?)</font>(?:\s*<[^>]*?>\s*)*"
wushuai1346 2011-11-24
  • 打赏
  • 举报
回复
太恶心了,想不出来
wushuai1346 2011-11-24
  • 打赏
  • 举报
回复
占个位子,马上贴正则
yrf741676206 2011-11-24
  • 打赏
  • 举报
回复
大神 求救啊
yrf741676206 2011-11-24
  • 打赏
  • 举报
回复
唉--! 大神很淡定啊
yrf741676206 2011-11-24
  • 打赏
  • 举报
回复
大神人呢
yrf741676206 2011-11-24
  • 打赏
  • 举报
回复
大神们不要隐身了 快出来啊
yrf741676206 2011-11-24
  • 打赏
  • 举报
回复
[Quote=引用楼主 yrf741676206 的回复:]
▪ 至强处理器在虚拟化领域有哪些...▪ 云计算与80年代“大型机-终端...▪ 什么是GPU?▪ 财务上能适应云计算的灵活性吗?▪ 向私有云过渡的步骤有哪些?detail b ----------------------------->
<TABLE WIDTH="100%" BORDER="0" ALIGN=……
[/Quote]
修改下获取的是
SGL-BBD23 和item No.后面的 SGL-BBD23 和 Built-In Bulbs Series
yrf741676206 2011-11-24
  • 打赏
  • 举报
回复
[Quote=引用 10 楼 return_false 的回复:]

C# code
string tempStr = File.ReadAllText(@"C:\Documents and Settings\Administrator\桌面\Test.txt", Encoding.GetEncoding("GB2312"));
string pattern = @"(?<=】((-->)(<[^>]+>)+|(?!-->)(<[^>]+……
[/Quote]

膜拜啊 大神
  • 打赏
  • 举报
回复
string tempStr = File.ReadAllText(@"C:\Documents and Settings\Administrator\桌面\Test.txt", Encoding.GetEncoding("GB2312"));
string pattern = @"(?<=】((-->)(<[^>]+>)+|(?!-->)(<[^>]+>)*))(?<text>[^<]+)";
foreach (Match m in Regex.Matches(tempStr, pattern))
{
//循环输出
string matchtext = m.Groups["text"].Value;

}

110,536

社区成员

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

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

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