asp.net C# 中 textbox 输入验证
如题所示,怎么样验证textbox输入的内容是邮箱,验证textbox是电话号码?谢谢
加个正则验证控件 @"^([a-z0-9A-Z]+[-|\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\.)+[a-zA-Z]{2,}$"; try this.... C# code: string str="aaassshhh@gmail.com"; if(str.indexOf("@")!=-1) { Response.Write("存在@字符"); } else { ....; }引用 @"^([a-z0-9A-Z]+[-|\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\.)+[a-zA-Z]{2,}$"; 正则表达式~~ asp.net自带的验证控件就可以 百度知道----正则表达式引用 C# codestring str="aaassshhh@gmail.com";if(str.indexOf("@")!=-1) { Response.Write("存在@字符"); }else { ....; } 这个写的不严谨。推荐正则表达式,不会的话可以用验证控件,其中就有如何验证邮箱的。 用个严谨的方法吧 在VS中自带的正则表达式验证控件 正则表达式 <asp:regularexpressionvalidator id="RegularExpressionValidator1" runat="server" ControlToValidate="txtemial" ValidationExpression="\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*&
相关问答:
select top 12 * from Product where [id] not in (select top 12 [id] from Product) 这样可以分页,但是我在后面想加个条件 select top 12 * from Product where [id] not in (select top 12 [id] from Prod ......
<script type="text/javascript" src="js/Dialog.js"></script> <script type="text/javascript"> function zOpenD() { va ......
Imports System.ComponentModel Imports System.Web.UI Imports System.Web.UI.Design Imports System.Web.UI.WebControls Namespace CBDAspNet.WebControls.HTML ''' <summary> '' ......
如下面的字符串: abc-bdef-axdg,我只想取到第一个"-"的位置,该怎么写???? C# code: string str = "abc-bdef-axdg"; Console.WriteLine(str.Substring(0, s ......