string temp = "<tr class=\"datagrid_item\"><td class=\"datagrid_item_date\" width=\"100\">02/18/09 </td><td class=\"datagrid_item\">Corp. News</td><td class=\"datagrid_item\"><div align=left><a href='newsdetail.aspx?auno=11253&ntype='>Digital Signage Expo 2009 in Las Vegas at the Las Vegas Convention Center (Feb. 24-26). </div></td> </tr><tr class=\"datagrid_item\"><td class=\"datagrid_item_date\" width=\"100\">02/04/09 </td><td class=\"datagrid_item\">Product News</td><td class=\"datagrid_item\"><div align=left><a href='newsdetail.aspx?auno=11250&ntype='>Fanless 2.4L Digital Engine™ (GM45 Chipset) Supports 45nm Core™ 2 Duo</div></td></tr><tr class=\"datagrid_item\"><td class=\"datagrid_item_date\" width=\"100\">02/04/09 </td><td class=\"datagrid_item\">Sales Kit</td><td class=\"datagrid_item\"><div align=left><a href='newsdetail.aspx?auno=11251&ntype='>DEX4501_Sales_Kit</div></td></tr><tr class=\"datagrid_item\"><td class=\"datagrid_item_date\" width=\"100\">01/16/09 </td><td class=\"datagrid_item\">Aopen Mike</td><td class=\"datagrid_item\"><div align=left><a href='newsdetail.aspx?auno=11225&ntype='>AOpen Mike Newsletter - January 2009</div></td></tr>"; MatchCollection mc = Regex.Matches(temp, @"(<a href='newsdetail.aspx?auno=)([\d\D]+)('>)", RegexOptions.IgnoreCase);
for (int i = 0; i < mc.Count; i++)
{
TextBox1.Text+= mc[i].Value + "\n";
}我只要提取出<a href='newsdetail.aspx?auno=********'>)类似这样的东西(超链接),为什么我的正则表达式一个都匹配不到呢?
大家帮个忙啊
解决方案 »
- 获取当前用户登录信息
- 问大伙一个小问题
- 数据更新的一个小问题,快急死了,饿肚等答案
- 怎么判断request中是否存在一个确定的参数?
- 关于继承后打开页面不能用视图方式编辑的问题
- 虚拟主机上jmail出错
- 在同个目录里保存已经存在的同名图片时发生gdi一般性错误,怎么解决?
- !!!急需您的建议和意见 !!!
- 头疼啊,困扰我很久的一个问题,请确保此代码文件中定义的类与“inherits”属性匹配.并且该类扩展的基类(例如 Page 或 UserControl)是正确
- 哪位老大说一下,有没有办法在asp.net的数据录入页面中只用方向键完成各文本框切换,包括上下左右(急!求职用) -
- [移动WEB]如何能获取到可以用来唯一识别的手机或手机卡的信息?
- 必须输入数字,如何判断?
在你基础上改一下就是
@"(<a href='newsdetail.aspx\?auno=)([\d\D]+?)('>)"
string temp = "<tr class=\"datagrid_item\"><td class=\"datagrid_item_date\" width=\"100\">02/18/09 </td><td class=\"datagrid_item\">Corp. News</td><td class=\"datagrid_item\"><div align=left><a href='newsdetail.aspx?auno=11253&ntype='>Digital Signage Expo 2009 in Las Vegas at the Las Vegas Convention Center (Feb. 24-26). </div></td> </tr><tr class=\"datagrid_item\"><td class=\"datagrid_item_date\" width=\"100\">02/04/09 </td><td class=\"datagrid_item\">Product News</td><td class=\"datagrid_item\"><div align=left><a href='newsdetail.aspx?auno=11250&ntype='>Fanless 2.4L Digital Engine™ (GM45 Chipset) Supports 45nm Core™ 2 Duo</div></td></tr><tr class=\"datagrid_item\"><td class=\"datagrid_item_date\" width=\"100\">02/04/09 </td><td class=\"datagrid_item\">Sales Kit</td><td class=\"datagrid_item\"><div align=left><a href='newsdetail.aspx?auno=11251&ntype='>DEX4501_Sales_Kit</div></td></tr><tr class=\"datagrid_item\"><td class=\"datagrid_item_date\" width=\"100\">01/16/09 </td><td class=\"datagrid_item\">Aopen Mike</td><td class=\"datagrid_item\"><div align=left><a href='newsdetail.aspx?auno=11225&ntype='>AOpen Mike Newsletter - January 2009</div></td></tr>"; MatchCollection mc = Regex.Matches(temp, @"<a\s+href='[^']+'>", RegexOptions.IgnoreCase);
for (int i = 0; i < mc.Count; i++)
{
TextBox1.Text+= mc[i].Value + "\n";
}/*结果:
<a href='newsdetail.aspx?auno=11253&ntype='>
<a href='newsdetail.aspx?auno=11250&ntype='>
<a href='newsdetail.aspx?auno=11251&ntype='>
<a href='newsdetail.aspx?auno=11225&ntype='>
*/