I have
<asp:RegularExpressionValidator ValidationExpression="\d+{1,4}(?:[.,]\d{1,4})?" />
but it doesn't' work, parser throws ArgumentException:
parsing "\d+{1,4}(?:[.,]\d{1,4})?"
Nested quantifier {.
Where is my mistake? I want to allow strings like xxxx,xxxx
- from 1 to 4 digits and decimal digits are not required, e.g.: 1000
, 99,99
, 0,249开发者_运维知识库8
, etc.
This looks wrong:
\d+{1,4}
Should be this:
\d{1,4}
The +
means 'one or more' and the {1,4}
means between one and four. They cannot be used together as it would not make sense.
I think this should do it:
\d{1,4}(?:,\d{1,4})?
I think you want
[.,]?
Instead of
?:[.,]
精彩评论