On 29/03/2013 11:31, Riccardo Costa wrote:
Hi Syncopers,

I'm currently using Syncope 1.0.6 and I've just try to use an "email" attribute of type 
string with validator class 
"org.apache.syncope.core.persistence.validation.attrvalue.EmailAddressValidator".
I set email attribute to value "[email protected]" but I received 
"Error:{[InvalidValues [email: [email protected]]], }"
I think that current email validator regular expression is a bit restrictive:

private static final Pattern EMAIL_PATTERN = 
Pattern.compile("^[\\w\\-]([\\.\\w])+[\\w]+@([\\w\\-]+\\.)+[A-Z]{2,4}$", 
Pattern.CASE_INSENSITIVE);

I'd like to suggest an improvment with something like this [1]

private static final Pattern EMAIL_PATTERN = 
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])?$",
 Pattern.CASE_INSENSITIVE);

WDYT?

+1, looks good to me (and applies to 1.1.0 as well).

Please file an improvement on JIRA and provide a patch.

In the meanwhile you can of course define your own mail validator class and use it in your project.

Regards.

[1] ref: http://www.regular-expressions.info/email.html

--
Francesco Chicchiriccò

ASF Member, Apache Syncope PMC chair, Apache Cocoon PMC Member
http://people.apache.org/~ilgrosso/

Reply via email to