我需要像这样的正则表达式(实际上是“ =”和“&”之间的ID(数字),例如“ = 376629&”):
我发现的是:
[^0-9$,]
但这不符合以下条件:
只有这个:
这场比赛将是我想要的“ 85808”。
可能是您可以帮助我,谢谢。
正则表达式
id=(\d+)
第一次捕获包含结果
测试字符串
http://gatherer.wizards.com/Pages/Card/Details.aspx?multiverseid=376629&part=Borrowing+100%2c000+Arrows
http://gatherer.wizards.com/Pages/Card/Details.aspx?multiverseid=85808&part=Boseiju%2c+Who+Shelters+All
结果
376629
85808
演示版
C#示例
string hrefValue = "http://gatherer.wizards.com/Pages/Card/Details.aspx?multiverseid=85808&part=Boseiju%2c+Who+Shelters+All";
string id = Regex.Match(hrefValue, @"id=(\d+)").Groups[1].Value;
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句