All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.codingapi.tx.netty.utils.IpAddressUtils Maven / Gradle / Ivy

There is a newer version: 4.1.0
Show newest version
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