码迷,mamicode.com
首页 > Windows程序 > 详细

C#常用正则验证

时间:2016-06-27 15:35:58      阅读:185      评论:0      收藏:0      [点我收藏+]

标签:

#region Protected Property
protected Regex rLetters { get { return new Regex("[a-zA-Z]{1,}"); } }
/// <summary>
/// 验证数字
/// </summary>
protected Regex rDigit { get { return new Regex("[0-9]{1,}"); } }
/// <summary>
/// 验证邮编
/// </summary>
protected Regex rPostNumber { get { return new Regex("^[0-9]{3,14}$"); } }
/// <summary>
/// 验证手机
/// </summary>
protected Regex rMobile { get { return new Regex(@"^1[3|4|5|8][0-9]\d{8}$"); } }
/// <summary>
/// 验证电话
/// </summary>
protected Regex rTelePhone { get { return new Regex(@"^[0-9]{2,4}-\d{6,8}$"); } }
/// <summary>
/// 验证传真
/// </summary>
protected Regex rFex { get { return new Regex(@"/^[0-9]{2,4}-\d{6,8}$"); } }
/// <summary>
/// 验证Email
/// </summary>
protected Regex rEmail { get { return new Regex(@"^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$"); } }
#endregion

C#常用正则验证

标签:

原文地址:http://www.cnblogs.com/niuzaihenmang/p/5620130.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!