RegularExpression validaor无法正常工作 [英] RegularExpression validaor not working
本文介绍了RegularExpression validaor无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想要一个regularrexpression验证器的代码,它允许十进制前4位数和十进制后2位数.....我使用下面的代码但它不起作用...如果我输入小数点前5位数据保存在数据库中....请帮帮我..........
< asp:RegularExpressionValidator runat = server ID = regLSLExpVal
< span class =code-attribute> ControlToValidate = txtLSL 显示 = 无 ErrorMessage = 十进制前只允许4位数。
ValidationExpression = ^ \d {1,4}(\.\d {1,2})?$ >
< / asp:RegularExpressionValidator >
解决方案
>
< / asp:RegularExpressionValidator >
这应该这样做:
^(\d {4}(。\d {2}))
要验证它,请访问:
JavaScript RegExp示例:正则表达式测试程序 [ ^ ]
- Amit
Hi,
I want code for regularexpression validator which allows 4 digit before decimal and 2 digit after decimal.....I used below code but it is not working...If I enter 5 digit before decimal it is saving in database....Please help me ..........
<asp:RegularExpressionValidator runat="server" ID="regLSLExpVal"
ControlToValidate="txtLSL" Display="None" ErrorMessage="Only 4 digits are allowed before decimal."
ValidationExpression="^\d{1,4}(\.\d{1,2})?$" >
</asp:RegularExpressionValidator>
解决方案
" > </asp:RegularExpressionValidator>
This should do it:
^(\d{4}(.\d{2}))
To validate it visit :
JavaScript RegExp Example: Regular Expression Tester[^]
--Amit
这篇关于RegularExpression validaor无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文