正则导致了CPU高

来源:互联网 发布:测量数据的表达方式 编辑:程序博客网 时间:2024/04/28 14:07

正则: ^(\d+(,)?)+$

字符串:1,2,3,4,6,11,22,45,9,1<

 

.net 下运行你就知道结果了。

 

查看干啥...

Current frame: (MethodDesc 000007fee2c80e28 +0x13 System.Text.RegularExpressions.RegexInterpreter.TrackPush2(Int32))
Child-SP         RetAddr          Caller, Callee
000000000028e8c0 000007fee2e08a07 (MethodDesc 000007fee2c80d40 +0x857 System.Text.RegularExpressions.RegexInterpreter.Go()), calling (MethodDesc 000007fee2c80e28 +0 System.Text.RegularExpressions.RegexInterpreter.TrackPush2(Int32))
000000000028e920 000007fee2e07abe (MethodDesc 000007fee2be64c0 +0x1fe System.Text.RegularExpressions.RegexRunner.Scan(System.Text.RegularExpressions.Regex, System.String, Int32, Int32, Int32, Int32, Boolean, System.TimeSpan))
000000000028e950 000007fee331f03e (MethodDesc 000007fee2c80d20 +0x6e System.Text.RegularExpressions.RegexInterpreter..ctor(System.Text.RegularExpressions.RegexCode, System.Globalization.CultureInfo)), calling *** ERROR: Symbol file could not be found.  Defaulted to export symbols for C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll -
clr+0x12b0
000000000028e990 000007fee2e02ee5 (MethodDesc 000007fee2b75b60 +0x1a5 System.Text.RegularExpressions.Regex.Run(Boolean, Int32, System.String, Int32, Int32, Int32)), calling (MethodDesc 000007fee2be64c0 +0 System.Text.RegularExpressions.RegexRunner.Scan(System.Text.RegularExpressions.Regex, System.String, Int32, Int32, Int32, Int32, Boolean, System.TimeSpan))
000000000028ea50 000007fee2e00830 (MethodDesc 000007fee2b75920 +0x50 System.Text.RegularExpressions.Regex.IsMatch(System.String)), calling (MethodDesc 000007fee2b75b60 +0 System.Text.RegularExpressions.Regex.Run(Boolean, Int32, System.String, Int32, Int32, Int32))

0 0