1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-12-25 00:58:50 -05:00

Use android.text.util.Regex.EMAIL_ADDRESS_PATTERN for email address verification before account creation.

Fixes issue 1386
This commit is contained in:
cketti 2010-04-08 11:51:54 +00:00
parent 0cd04a66c1
commit 96489049d9

View File

@ -1,20 +1,11 @@
package com.fsck.k9;
import java.util.regex.Pattern;
import android.text.util.Rfc822Tokenizer;
import android.widget.AutoCompleteTextView.Validator;
public class EmailAddressValidator implements Validator
{
// Source: http://www.regular-expressions.info/email.html
private static Pattern p = Pattern.compile(
"[a-z0-9!#$%&'*+/=?^_`{|}~-]+" +
"(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*" +
"@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+" +
"[a-z0-9](?:[a-z0-9-]*[a-z0-9])?");
public CharSequence fixText(CharSequence invalidText)
{
return "";
@ -27,6 +18,6 @@ public class EmailAddressValidator implements Validator
public boolean isValidAddressOnly(CharSequence text)
{
return p.matcher(text).matches();
return android.text.util.Regex.EMAIL_ADDRESS_PATTERN.matcher(text).matches();
}
}