本文介绍了asp.net RegularExpressionValidator ValidationExpression的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想制作一个asp.net Regularexpressionvalidator ValidationExpression来阻止输入;和-.

我可以做到–它是ValidationExpression ="[^-] *"

I want to make a asp.net regularexpressionvalidator ValidationExpression that will prevent to give input ; and –- .

I can do for – and it is ValidationExpression="[^-]*"

<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" 

            ControlToValidate="TextBox1" Display="Dynamic" ErrorMessage="**" 

            ValidationExpression="[^-]*"  >



以上表达可以防止单字符.我将允许单身人士.我将阻止使用双字符(-).
我需要预防;和–一次.



块:; .......--
:; ......-
允许:....-

有人可以帮我吗?



Above expression can prevent single – character. I will give permission for single – chareter. I will block for double – character (--).
I need to prevent ; and – at a time.



block: ;.......--
:;......-
allow:....-

Can anyone help me?

推荐答案

<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" 
            ControlToValidate="TextBox1" Display="Dynamic" ErrorMessage="**" 
            ValidationExpression="^[--;-]



这篇关于asp.net RegularExpressionValidator ValidationExpression的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-27 02:19