首页  >  文章  >  后端开发  >  Email URL的判断和自动转换函数_PHP教程

Email URL的判断和自动转换函数_PHP教程

WBOY
WBOY原创
2016-07-20 10:59:48816浏览

 

function validateEmail($email)
{ return eregi("^[_a-z0-9-] (.[_a-z0-9-] )*@[a-z0-9-] (.[a-z0-9-] )*(.[a-z]{2,3})$", $email);
}

function validateURL($url)
{ return eregi("^((ht|f)tp://)((([a-z0-9-] (.[a-z0-9-] )*(.[a-z]{2,3}))|(([0-9]{1,3}.){3}([0-9]{1,3})))((/|?)[a-z0-9~#%&'_ =:?.-]*)*)$", $url);
}

function convertURLS($text)
{ $text = eregi_replace("((ht|f)tp://www.|www.)([a-z0-9-] (.[a-z0-9-] )*(.[a-z]{2,3})((/|?)[a-z0-9~#%&/'_ =:?.-]*)*)", "http://www.3", $text);
$text = eregi_replace("((ht|f)tp://)((([a-z0-9-] (.[a-z0-9-] )*(.[a-z]{2,3}))|(([0-9]{1,3}.){3}([0-9]{1,3})))((/|?)[a-z0-9~#%&'_ =:?.-]*)*)", "


www.bkjia.comtruehttp://www.bkjia.com/PHPjc/445559.htmlTechArticlefunction validateEmail($email) { return eregi(^[_a-z0-9-] (.[_a-z0-9-] )*@[a-z0-9-] (.[a-z0-9-] )*(.[a-z]{2,3})$, $email); } function validateURL($url) { return eregi(^((ht|f)tp://...
声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn