Home > Backend Development > PHP Tutorial > Email+URL judgment and automatic conversion function_PHP tutorial

Email+URL judgment and automatic conversion function_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-21 16:04:41
Original
1117 people have browsed it

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~#%&'_+=:?.-]*)*)", "\0", $text);  
    return $text;  
}  

function convertMail($text)  
{     $text = eregi_replace("([_a-z0-9-]+(.[_a-z0-9-]+)*@[a-z0-9-]+(.[a-z0-9-]+)*(.[a-z]{2,3}))", "\0", $text);  
    return $text;  
}  

function convertAllLinks($text)  
{     $text = convertURLS($text);  
    $text = convertMail($text);  
    return $text;  
}
?>  

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/315921.htmlTechArticle?php 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)...
Statement of this Website
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
Latest Issues
PHP mail function cannot send email completely
From 1970-01-01 08:00:00
0
0
0
PHP mail function cannot complete sending email
From 1970-01-01 08:00:00
0
0
0
PHP mail function cannot complete sending email
From 1970-01-01 08:00:00
0
0
0
PHP mail function cannot send email completely
From 1970-01-01 08:00:00
0
0
0
PHP mail function did not complete sending email
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template