ASP.NET利用正则表达式提取字符串中的数字

一言不足以毕之,请LOOK代码:

            string text = " 订单5|本次付款:4783|本单结清,";
            
string pat = @"(\d+)";
            Regex r 
= new Regex(pat, RegexOptions.IgnoreCase);
            Match m 
= r.Match(text);
            
int matchCount = 0;
            
while (m.Success)
            {
                
++matchCount;
                Group g 
= m.Groups[1];
                Response.Write(
"Match" + matchCount +""+ g + "<br />");

                m 
= m.NextMatch();
            }
撸码:复制、粘贴,拿起键盘就是“干”!!!
原文地址:https://www.cnblogs.com/niunan/p/1456870.html