You are here: heads or tails of email address parser « PHP Programming Language « IT news, forums, messages
heads or tails of email address parser

Posted by chadlupkes on 02/18/07 06:11

I have this code from someone else, and I'm trying to make heads or
tails of it because IE doesn't like it. Can anyone help? Or does
anyone have a better idea?

/* parse the email to check for valid form */
function parseemail(str)
{
str = trim(str);
<?if(preg_match("/MSIE 5.0;/", $_SERVER['HTTP_USER_AGENT'])) // this
is IE 5.0
{?>
if(str.search(/\w+@[\w\W]+\.[a-z]{3}/) == -1)
{
window.alert("Please enter a valid email address");
return true;
}
<?}else{ // not IE 5.0
?>
if(str.search(/^[\w\-\.]+[@][\w\-]+(?:\.[\w\-]+)+$/) == -1) // ||
str.search(/.+?\@([\w.-]+?\s)/) == -1)
{
window.alert("Please enter a valid email address");
return true;
}
<?}?>
}

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация