我有
<asp:RegularExpressionValidator ValidationExpression="\d+{1,4}(?:[.,]\d{1,4})?" />
但它不起作用,解析器抛出 ArgumentException:
parsing "\d+{1,4}(?:[.,]\d{1,4})?"
Nested quantifier {.
我的错误在哪里?我想允许像 xxxx,xxxx
这样的字符串 - 不需要 1 到 4 位数字和十进制数字,例如:1000
、99,99
, 0,2498
等
最佳答案
这看起来不对:
\d+{1,4}
应该是这样的:
\d{1,4}
+
表示“一个或多个”,{1,4}
表示一到四之间。它们不能一起使用,因为它没有意义。
关于.net - 为什么RegularExpressionValidator中的 "\d+{1,4}(?:[.,]\d{1,4})?"抛出异常: "Nested quantifier {",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2739216/