> +public class Strings3 {
> +
> + private static final String MAC_ADDR_FORMAT =
> "^([0-9a-f]{2}[:]){5}([0-9a-f]{2})$";
> + private static final String IP_ADDR_FORMAT
> + = "^([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\."
> + + "([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\."
> + + "([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\."
> + + "([01]?\\d\\d?|2[0-4]\\d|25[0-5])$";
> + private static final Pattern MAC_ADDR_PATTERN =
> Pattern.compile(MAC_ADDR_FORMAT);
> + private static final Pattern IP_ADDR_PATTERN =
> Pattern.compile(IP_ADDR_FORMAT);
> +
> + public static boolean isMacAddress(String in) {
> + return MAC_ADDR_PATTERN.matcher(in).matches();
> + }
> +
> + public static boolean isIpAddress(String in) {
Prefer Guava's `InetAddresses.isInetAddress(String)` to this method?
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/139/files#r25333044