regex .
, ? , . - .
.
. , ( ). String.Split() , , . . decimal , . , "1-2-3;", "1:.:" - , . [2] "1: 2", , . , , , . - danbruc
, Microsoft PEX David. David , List<List<Decimal>>, .
, PEX, 45 9 .
019.;,-:!
, () . 9, , 0 1 - PEX 1000 999. 0 1, , 0.000 [...] 001 . , , . 44 (44 - 28 29 ), , . , . , .
, . PEX . ( ), NullReferenceException PEX , "9999999999999999999999999999999999" Decimal.Parse() OverflowException.
PEX . , "!; 9,;.;., 990:!!:, 900: 09" , FormatException. . , ".0" . , , Decimal.Parse() () , . . .
PEX . . . FormatException, PEX IndexOutOfRangeException.
FormatException: "!,"
FormatException: ","
FormatException: "1,"
FormatException: "!"
FormatException: ";9"
FormatException: "::"
FormatException: "!.999009"
FormatException: "!.0!99!9"
FormatException: "0,9.90:!!,,,!,,,,,,!,,,0!!!9,!"
FormatException: ""
FormatException: "-99,9"
FormatException: "1,9,,,!,,,,,,9,,,9,1,!9,,,,!,!"
FormatException: "!:,"
FormatException: "!9!:.!!,!!!."
FormatException: "!:"
IndexOutOfRangeException: "1:9"
FormatException: "09..::!"
FormatException: "9,0..:!.!,,,!,,,,,,!,,,!!-,!,!"
OverflowException: "99999999999999999999999999999999999999999999"
FormatException: "!."
FormatException: "999909!!"
FormatException: "-"
FormatException: "9,9:9:999,,,9,,,,,,!,,,!9!!!,!"
FormatException: "!9,"
FormatException: "!.09!!0!"
FormatException: "9-;"
FormatException: ":"
FormatException: "!.!9!9!!"
NullReferenceException: null
FormatException: ":,"
FormatException: "!!"
FormatException: "9;"
, . try/catch. , , . , , .
, . , , PEX , Decimal.Parse().
ParseExpression(string) 100,00% 10/10 blocks
ParseSubExpression(string) 96,15% 25/26 blocks
ParseExpressionRegex(string) 95,06% 77/81 blocks
ParseExpressionRegexSingle(string) 94,87% 74/78 blocks
- . , , , . - , , . .