From dc967a8c938ba0c90afcc7c38b84f8dbcc516beb Mon Sep 17 00:00:00 2001 From: Carl Date: Fri, 13 Jul 2012 13:23:19 -0500 Subject: [PATCH] Issue 17 Changed custom email pattern matching regex to android.util.Patterns.EMAIL_ADDRESS to accommodate valid email addresses the original pattern did not. (e.g. a@aaa.aa, a+aaa@aaa.aaa) This commit is to fix issue 17 (https://github.com/WhisperSystems/TextSecure/issues/17) --- src/org/thoughtcrime/securesms/util/NumberUtil.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/org/thoughtcrime/securesms/util/NumberUtil.java b/src/org/thoughtcrime/securesms/util/NumberUtil.java index b84d0b68fc..0dc6105191 100644 --- a/src/org/thoughtcrime/securesms/util/NumberUtil.java +++ b/src/org/thoughtcrime/securesms/util/NumberUtil.java @@ -1,5 +1,5 @@ /** - * Copyright (C) 2011 Whisper Systems + * Copyright (C) 2012 Whisper Systems * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -22,9 +22,8 @@ import java.util.regex.Pattern; import android.telephony.PhoneNumberUtils; public class NumberUtil { - - private static final String emailExpression = "^[\\w\\-]([\\.\\w])+[\\w]+@([\\w\\-]+\\.)+[A-Z]{2,4}$"; - private static final Pattern emailPattern = Pattern.compile(emailExpression, Pattern.CASE_INSENSITIVE); + + private static final Pattern emailPattern = android.util.Patterns.EMAIL_ADDRESS; public static boolean isValidEmail(String number) { Matcher matcher = emailPattern.matcher(number);