IP地址正则式(转)

    技术2022-05-11  3

    private bool FoundMatch(string txt) { try { return Regex.IsMatch(txt, @"^(/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])$"); } catch (ArgumentException ex) { // Syntax error in the regular expression return false; } }

    最新回复(0)