我爱Aspx >> Asp.Net >> C#正则表达式应用范例Regex objNumberPattern =new Regex("(" + strValidRealPattern +")|(" + strValidIntegerPattern + ")");
return !objNotNumberPattern.IsMatch(strNumber) &&
!objTwoDotPattern.IsMatch(strNumber) &&
!objTwoMinusPattern.IsMatch(strNumber) &&
objNumberPattern.IsMatch(strNumber);
}
// Function To test for Alphabets.
public bool IsAlpha(String strToCheck)
{
Regex objAlphaPattern=new Regex("[^a-zA-Z]");
return !objAlphaPattern.IsMatch(strToCheck);
}
// Function to Check for AlphaNumeric.
public bool IsAlphaNumeric(String strToCheck)
{
Regex objAlphaNumericPattern=new Regex("[^a-zA-Z0-9]");
return !objAlphaNumericPattern.IsMatch(strToCheck);
}
}
There is another simple way to perform these validation think of it while the next article comes.
Ҷƪл˵?
C#编程发送邮件[05-20]
c# 支持SMTP服务器认证的邮件发送..[05-20]
C# 格式化字符串 String.Format[05-20]
C# 格式化字符串 String.Format[05-20]
C#实现控件数组[05-20]
用C#读取图片的EXIF信息的方法[05-20]
用Visual C#实现文件下载[05-20]
使用C#调用外部Ping命令获取网络..[05-20]
使用C#控制远程计算机的服务[05-20]
使用C#编写的一个定时关机程序[05-20]
ASP生成静态网页的方法[05-20]
用ASP动态生成JavaScript的表单验..[05-20]
使用ASP实现http://xx@xx.xx虚拟..[05-20]
用ASP编程控制在IIS建立Web站点[05-20]
TrackBack 技术规范[05-20]
C#编程发送邮件[05-20]
c# 支持SMTP服务器认证的邮件发送..[05-20]
加固Windows Server 2003 IIS 服..[05-20]
C# 格式化字符串 String.Format[05-20]
C# 格式化字符串 String.Format[05-20]