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

怎么用正则表达式将提出所需内容

2012-02-06 
如何用正则表达式将提出所需内容有这样一段html编码,ahref javascript:gotopage(2533768)title 本章字

如何用正则表达式将提出所需内容
有这样一段html编码,
<a   href= 'javascript:gotopage(2533768) '   title= '本章字数:2835   更新日期:2007-1-22 '   target=_top> 第一章   色狼下山 </a>
    如何将javascript:gotopage(2533768)中的数字取出

[解决办法]
string str = textBox1.Text;
string pattern = @ "(? <=gotopage\()\d+ ";
Regex regex = new Regex(pattern, RegexOptions.Singleline);
string result = regex.Match(str).Value;
MessageBox.Show(result);

热点排行