1. IsMatch()

 //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])$");

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

相关文章:

  • 2022-12-23
  • 2021-12-14
  • 2022-02-03
  • 2022-12-23
  • 2022-12-23
  • 2021-07-28
  • 2021-07-24
猜你喜欢
  • 2021-09-05
  • 2021-08-04
相关资源
相似解决方案