Textbox的正则表达式(其模式为多个)允许100个字符 [英] Regular Expression for Textbox (whose mode is multiple) to allow 100 character
本文介绍了Textbox的正则表达式(其模式为多个)允许100个字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的表单中,我使用了模式为多个的文本框。我想只允许100个字符(包括数字,特殊字符和字符).Maxlength不适用于textbox。什么是我的正则表达式?
< asp:TextBox ID = tb runat = server TextMode = MultiLine < span class =code-keyword>> < / asp:TextBox < span class =code-keyword>>
//正则表达式验证器
< asp:RegularExpressionValidator ID = RegularExpressionValidator1
runat = server ControlToValidate = tb
ErrorMessage = 请输入最多100个字符。
SetFocusOnError = true ValidationExpression = ^ [a-zA-Z。] {0,100} $ >
< / asp:RegularExpressionValidator >
这只包括角色。我想要麻木呃,spl char或者任何但是计数不应该大于100.怎么做?
解决方案
>
< / asp:RegularExpressionValidator >
这只包括字符。我想要数字,spl char或者任何但是数字应该是怎么做?
如果你想允许任何角色,可以试试
ValidationExpression = (。{0,100})
或
ValidationExpression =^(。{0,100})
In my form I used textbox whose mode is multiple.I want to allow only 100 character (including number,special character and char).Maxlength will not work with textbox.What will be my Regular Expression?
<asp:TextBox ID="tb" runat="server" TextMode="MultiLine" ></asp:TextBox>
//Regular Expression validator
<asp:RegularExpressionValidator ID="RegularExpressionValidator1"
runat="server" ControlToValidate="tb"
ErrorMessage="Please enter maximum 100 charachters."
SetFocusOnError="true" ValidationExpression="^[a-zA-Z.]{0,100}$">
</asp:RegularExpressionValidator>
This include character only.I want number,spl char or any but count should not greater than 100.How to do that?
解决方案
"> </asp:RegularExpressionValidator>
This include character only.I want number,spl char or any but count should not greater than 100.How to do that?
If you want to allow any character, try simply
ValidationExpression="(.{0,100})"
or
ValidationExpression="^(.{0,100})
"
这篇关于Textbox的正则表达式(其模式为多个)允许100个字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文