RegularEx pressionValidator.ValidationEx pression强制长度在10或12个符号 [英] RegularExpressionValidator.ValidationExpression to force length in 10 or 12 symbols
问题描述
RegularEx pressionValidator.ValidationEx pression =\ D {10}
只意味着数字 - 10最大值
RegularExpressionValidator.ValidationExpression="\d{10}"
means only digits - 10 max.
RegularEx pressionValidator.ValidationEx pression =\ D {10,12}
只意味着数字 - 10,11或12
RegularExpressionValidator.ValidationExpression="\d{10,12}"
means only digits - 10, 11 or 12.
如何强制严格的10个或12个符号?
How to force strictly 10 or 12 symbols?
推荐答案
^ \ D {10} $ | ^ \ D {12} $
两个 ^ $
如果你想要一个准确的10或12位数字是非常重要的。
The two ^$
are important if you want an exact 10 or 12 digits.
顺便说一句,如果你是做了很多的正则表达式的这个网站是伟大的: http://rubular.com/
By the way, If you are making a lot of regexp this website is great : http://rubular.com/
玩得开心
这篇关于RegularEx pressionValidator.ValidationEx pression强制长度在10或12个符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!