Address的常规验证表达式

时间:2014-01-18 15:10:23

标签: asp.net

    </asp:RequiredFieldValidator>  
    <asp:RegularExpressionValidator   
        ID="RegularExpressionValidatoradd" runat="server" ValidationExpression=""  ControlToValidate="textboxadd" ErrorMessage="Enter Valid address!" >  
    </asp:RegularExpressionValidator> 

我不想要这些字符~`!@ $%^ * + =} {[]“:;?&gt;&lt;在我的textboxadd中。现在我应该在ValidationExpression中写什么=”“

1 个答案:

答案 0 :(得分:0)

试试这个

 </asp:RequiredFieldValidator>  
    <asp:RegularExpressionValidator   
        ID="RegularExpressionValidatoradd" runat="server" ValidationExpression="\d{1,5}\s\w.\s(\b\w*\b\s){1,2}\w*\."  ControlToValidate="textboxadd" ErrorMessage="Enter Valid address!" >  
    </asp:RegularExpressionValidator> 

<强>(或)

</asp:RequiredFieldValidator>  
        <asp:RegularExpressionValidator   
            ID="RegularExpressionValidatoradd" runat="server" ValidationExpression="[0-9a-zA-Z #,-]+"  ControlToValidate="textboxadd" ErrorMessage="Enter Valid address!" >  
        </asp:RegularExpressionValidator>