开发者

Regex Validator allowing letters when it shouldn't - VAB

I'm doing the validation through configuration files. But, RegexValidator does not work properly.

This Validator not disciplined even to unknown regular expression!!

For example,开发者_开发问答 if I add a RegexValidator to field with regular expression \d, It allow also Letters. it validate only first Character. Also, if I set more than 15 Characters the validation fails.

Do you know about this problem?


Thanks, it really helps things work better! But I still have a problem if I put more than 15 numbers, validation fails, even though I write a format: ^(\d{1,20})$ Maybe you have an idea?


I am not sure exactly what your problems is but i suspect that it can be solved by using Regex Anchors. You can read more about them here.

An example of there use would be as follows;

'\d' true if there is any digit anywhere in the test string
'^\d$' true if the string ONLY contains a single digit
'^\d*$' true if the string ONLY contains 0 or more digits
'^\d+$' true if the string ONLY contains 1 or more digits
'^\d{5}$' true if the string ONLY contains exactly 5 digits (i.e. a zip code)

Hope this helps guide you in the correct direction.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜