java - Android android.util.Patterns.EMAIL_ADDRESS strange behaviour -
today experienced strange pattern behaviour.
for instance, on tablet 3.2 stock rom(previously 4.0.+) works well.
but on other 3.2 tablets , 4.0 devices doesn't.
function test email functionality like:
public static boolean checkemail(charsequence emailaddress){ if( build.version.sdk_int >= 8 ){ return android.util.patterns.email_address.matcher(emailaddress).matches(); } ....
so have in 16'th sources email addres pattern(java code):
public static final pattern email_address = pattern.compile( "[a-za-z0-9\\+\\.\\_\\%\\-\\+]{1,256}" + "\\@" + "[a-za-z0-9][a-za-z0-9\\-]{0,64}" + "(" + "\\." + "[a-za-z0-9][a-za-z0-9\\-]{0,25}" + ")+" );
here 'normalised' version:
[a-za-z0-9\\+\\.\\_\\%\\-\\+]{1,256}\\@[a-za-z0-9][a-za-z0-9\\-]{0,64}(\\.[a-za-z0-9][a-za-z0-9\\-]{0,25})+
regexpal(js regex validator) tells regexp proper, in round brace \\.
should \.
, \\@
should \@
work in regexpal.
moreover not quite clear, why there 2 '\+' group of symbols in first braces?
get value of pattern using pattern.pattern()
function device on works , make own pattern
object out of it. way won't have differences in implementations across devices. same goes geocoder
, didn't work me on devices.
Comments
Post a Comment