我在 RegEx 上真的很糟糕,在下面的代码中,我只想要和之间的实际数字,SH:
我, or end of line.
该如何实现?
[TestMethod]
public void Sandbox()
{
var regEx = new Regex(@"SH\:(.*?)(\,|\z)");
var matches = regEx.Matches("Some Text|SH:0000000000,SH:1111111111");
foreach (var match in matches)
{
Console.Out.WriteLine(match);
/* Getting this
SH:0000000000,
SH:1111111111
*/
/* Wanting this
0000000000
1111111111
*/
}
}