function is_email_address_snowMod($address){
//one and only one @ in a validate addr
if ( 1 == substr_count($address,'@') ){
//after @,there are at least one '.'
$pos_of_at = strpos($address, '@');
$pos_of_first_dot = strpos($address, '.', $pos_of_at);
if ($pos_of_first_dot) {
//after @domain. ,there are top domain,which has at least two digits
$top_domain_len = strlen($address) - $pos_of_first_dot - 1;
if ( $top_domain_len >= 2 ) {
return TRUE;
}
}
}
return FALSE;
}
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by RaĆ¼l Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.
- DhrupDeScoop@Dhrup2000
DhrupDeScoop - 0 likes
- Snow.Hellsing@openid_20310
Snow.Hellsing - 0 likes
- DhrupDeScoop@Dhrup2000
DhrupDeScoop - 0 likes
- Marcus Povey@marcus
Marcus Povey - 0 likes
- Snow.Hellsing@openid_20310
Snow.Hellsing - 0 likes
You must log in to post replies.but why so much php LOC ;-)
RFC 822 specification :: validation RegEx ==>
(?<user>(?:(?:[^ \t\(\)\<\>@,;\:\\\"\.\[\]\r\n]+)|(?:\"(?:(?:[^\"\\\r\n])|(?:\\.))*\"))(?:\.(?:(?:[^ \t\(\)\<\>@,;\:\\\"\.\[\]\r\n]+)|(?:\"(?:(?:[^\"\\\r\n])|(?:\\.))*\")))*)@(?<domain>(?:(?:[^ \t\(\)\<\>@,;\:\\\"\.\[\]\r\n]+)|(?:\[(?:(?:[^\[\]\\\r\n])|(?:\\.))*\]))(?:\.(?:(?:[^ \t\(\)\<\>@,;\:\\\"\.\[\]\r\n]+)|(?:\[(?:(?:[^\[\]\\\r\n])|(?:\\.))*\])))*)
@Dhrup Thx a lot.Honorly I didn't know RFC822 before... In the other hand,for the readability,still i prefer PHP.
@Dave I'd like to contribute my work.But because of my college's awful network,i can't connect to elgg's svn or http://trace.elgg.org/elgg/.
@Snow
;-O
re: RFC 822
plz be welcome to send me message and we can discuss further...
Technically speaking..
we can sometimes code many lines of PHP
or sometimes..
code 1 or 2 lines of a regular expression which by <intrinsic definition> performs the same task !
@snow Dave made a typo... the address should be http://trac.elgg.org/elgg/
@Marcus OMG...what a amazing system...I'm engaging development on a private social network based on Elgg1.5.Which planning to deliver on May 31th.So after that i will learn how to use that system.
@Dhrup thx a lot.I will contact u when I fall in a dogfight with RegEx again.