From 5362627f35b5365d78f71fde387f4349ff1ce972 Mon Sep 17 00:00:00 2001 From: chteufleur Date: Thu, 3 Sep 2015 17:59:10 +0200 Subject: [PATCH] Fix ip regex bug --- Java/Regex.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Java/Regex.java b/Java/Regex.java index c9f7c05..aee5301 100644 --- a/Java/Regex.java +++ b/Java/Regex.java @@ -1,5 +1,5 @@ public static boolean isIp(String ip) { - return ip.matches("^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$"); + return ip != null && !ip.equals("") && ip.matches("^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$"); }