正则精简版

//邮件正则表达式

        private static Regex _emailregex = new Regex(@"[a-zA-Z0-9_\-\.]+@\w+(\.\w+)+", RegexOptions.IgnoreCase);

        //手机号正则表达式

        private static Regex _mobileregex = new Regex("^(13|15|18)[0-9]{9}$");

        //固话号正则表达式

        private static Regex _phoneregex = new Regex(@"^(\d{3,4}-?)?\d{7,8}$");

        //IP正则表达式

        private static Regex _ipregex = new Regex(@"^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$");

        //日期正则表达式

        private static Regex _dateregex = new Regex(@"(\d{4})-(\d{1,2})-(\d{1,2})");

        //数值(包括整数和小数)正则表达式

        private static Regex _numericregex = new Regex(@"^[-]?[0-9]+(\.[0-9]+)?$");

        //邮政编码正则表达式

        private static Regex _zipcoderegex = new Regex(@"^\d{6}$");

 

你可能感兴趣的:(正则)