常用正则表达式集锦

1. IsMatch()

 //IP正则表达式
        private static Regex _ipregex = new Regex(@"^(d{1,2}|1dd|2[0-4]d|25[0-5]).(d{1,2}|1dd|2[0-4]d|25[0-5]).(d{1,2}|1dd|2[0-4]d|25[0-5]).(d{1,2}|1dd|2[0-4]d|25[0-5])$");

  /// <summary>
        /// 是否为IP
        /// </summary>
        public static bool IsIP(string s)
        {
            return _ipregex.IsMatch(s);
        }
View Code

2. 

原文地址:https://www.cnblogs.com/lihongchen/p/3987971.html