(?si)<a\s+.*?>(?<title>.*?)</a>
解决方案 »
- c#多线程问题
- 为甚么下面代码在listview内显示不了数据库内容!各位大仙帮帮忙啊?
- MicrosoftAjax.js 错误
- Sql 数据类型选择
- C#中如何将整个网页截屏保存为图片???
- FastReport 那些版本支持Windows7
- 谈谈你在把vs.net2003的工程转换成vs2005的过程中遇到的问题
- 如何设置默认输入法为半角状态,
- 求助ACR122U读卡器用winscard API设备连接不上~
- 关于C#打包问题,installshield,C#都行
- 简化程序开发的框架Custom
- c#用windows Media Player (wmp.dll) 做mp3播放器的弹网页的问题
我这个应该怎么改呢!
using System.Text.RegularExpressions;class Program
{
static void Main()
{
string input = @"
<tr>
<th>53 </th>
<td> <a href=""http://www.sogou.com/web?query=%D6%D0%B9%FA%B5%E7%D7%D3%B5%D8%CD%BC&w=01020602"" target=""_blank"">中国电子地图 </a> </td>
<td> <img src=""/images/hint_bar.gif"" width=""12"" height=""13""> </td>
</tr>
<tr>
<th>54 </th>
<td> <a href=""http://www.sogou.com/web?query=%D6%D0%B9%FA%C2%C1%D2%B5&w=01020602"" target=""_blank"">中国铝业 </a> </td>
<td> <img src=""/images/hint_bar.gif"" width=""12"" height=""13""> </td>
</tr>
";
MatchCollection mc = Regex.Matches(input, @"(?si)<a\b+.*?>(?<title>.*?)</a>");
foreach (Match m in mc)
{
Console.WriteLine(m.Groups["title"].Value);
}
}
}
/* 程序输出:
中国电子地图
中国铝业
*/
foreach (Match m in mc)
{
Console.WriteLine(m.Groups["title"].Value);
}