【发布时间】:2015-09-16 11:07:56
【问题描述】:
我正在寻找以下行为的模式:
number1-number2
number1: Can be everything >= 0 and <= int.MaxValue
number2: Can be everything >= number1 and <= int.MaxValue
例如
"1-2" => True
"0-0" => True
"10-22" => True
"22-10" => False
"10-10" => True
"a-b" => False
如果我能直接提取两个int值也很好。
【问题讨论】:
-
不,这不可能通过正则表达式实现..
-
@PranavCBalan 那他为什么说
"22-10" => False?查看顺序。 -
@AvinashRaj : 哦错过了.... :)
-
为什么你不只是split和if?我认为你不能用正则表达式检查这个条件
number2: Can be everything >= number1 and <= int.MaxValue