From 7f2601df17d145d4a8477b11231a5cb9a0f5115f Mon Sep 17 00:00:00 2001 From: Matthew Brace Date: Mon, 19 Jan 2009 00:48:20 +0000 Subject: [PATCH] Updated regular expression to allow directory path in server field. Some whitespace cleanup (tabs to spaces). --- src/com/android/email/Utility.java | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/com/android/email/Utility.java b/src/com/android/email/Utility.java index 3b5302e81..0e33ef3c6 100644 --- a/src/com/android/email/Utility.java +++ b/src/com/android/email/Utility.java @@ -83,20 +83,20 @@ public class Utility { } public static boolean domainFieldValid(EditText view) { - if (view.getText() != null) { - String s = view.getText().toString(); - if (s.matches("^([a-zA-Z0-9]([a-zA-Z0-9\\-]{0,61}[a-zA-Z0-9])?\\.)+[a-zA-Z]{2,6}$")) { - return true; - } - if (s.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 true; - } - if ((s.equalsIgnoreCase("localhost"))||(s.equalsIgnoreCase("localhost.localdomain"))) { - return true; - } - } - return false; - } + if (view.getText() != null) { + String s = view.getText().toString(); + if (s.matches("^([a-zA-Z0-9]([a-zA-Z0-9\\-]{0,61}[a-zA-Z0-9])?\\.)+[a-zA-Z]{2,6}(\\/([a-zA-Z0-9\\-~])+)?$")) { + return true; + } + if (s.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 true; + } + if ((s.equalsIgnoreCase("localhost"))||(s.equalsIgnoreCase("localhost.localdomain"))) { + return true; + } + } + return false; + } /** * Ensures that the given string starts and ends with the double quote character. The string is not modified in any way except to add the