com.codingapi.tx.netty.utils.IpAddressUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of tx-client Show documentation
Show all versions of tx-client Show documentation
tx-client project for Spring Boot
package com.codingapi.tx.netty.utils;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* create by lorne on 2017/12/12
*/
public class IpAddressUtils {
private final static String ipAddressRegex = "([1-9]|[1-9]\\d|1\\d{2}|2[0-4]\\d|25[0-5])(\\.(\\d|[1-9]\\d|1\\d{2}|2[0-4]\\d|25[0-5])){3}:([0-9]|[1-9]\\d{1,3}|[1-5]\\d{4}|6[0-5]{2}[0-3][0-5])";
private final static Pattern pattern = Pattern.compile(ipAddressRegex);
public static boolean isIpAddress(String ipAddress){
Matcher matcher = pattern.matcher(ipAddress);
return matcher.matches();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy