Home  >  Article  >  Backend Development  >  Regular expression to judge email and URL, please help me see if there is anything to add._PHP Tutorial

Regular expression to judge email and URL, please help me see if there is anything to add._PHP Tutorial

WBOY
WBOYOriginal
2016-07-13 10:59:41931browse


echo 'a:'.htmlspecialchars($a);
echo '
a1:';
$a1 = eregi_replace('(^[_.][:alnum:]-]+@([[:alnum:]][[:alnum:]-]*.)+[[:alpha:]]{2,3}$)',' 1 ', $a) ;
echo htmlspecialchars($a1);
echo "
a1:$a1";
echo '
a2:';
$a2 = eregi_replace('([[:alnum:]]+://([[:alnum:]][[:alnum:]-]*.)+[[:alpha:]]{2,3}([#?/][^#?/][:space:]][^[:space:]]*)?)',
        '1', $a);
echo htmlspecialchars($a2);
echo "
a2:$a2";
// eregi('^[_.][:alnum:]-]+@([[:alnum:]][[:alnum:]-]*.)+[[:alpha:]]{2,3}$',$a) or die("not a email");
?>





    

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/631878.htmlTechArticlebodyonload=f.a.select(); ?php echo 'a:'.htmlspecialchars($a); echo 'bra1:'; $a1 = eregi_replace('(^[_.][:alnum:]-]+@([[:alnum:]][[:alnum:]-]*.)+[[:alpha:]]{2,3}$)',' a href=mailto:1...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn