校验MAC地址:
String patternMac="^[a-fA-F0-9]{2}(-[a-fA-F0-9]{2}){5}$";
boolean b1 = Pattern.compile(patternMac).matcher(sdi.getSbmac()).find();
校验IPV4地址:
String IPV4="^((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]|[*])\.){3}(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]|[*])$";
boolean b1 = Pattern.compile(IPV4).matcher(ip).find();
校验IPV6地址:
String ipv6="^(^((\p{XDigit}{1,4}):){7}(\p{XDigit}{1,4})$)|(^(\p{XDigit}{1,4})?::(\p{XDigit}{1,4})$)|(^((\p{XDigit}{1,4}):){0,5}(\p{XDigit}{1,4})::(\p{XDigit}{1,4})$)$";
boolean b4 = Pattern.compile(ipv6).matcher(ip).find();
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)