Home > Backend Development > PHP Tutorial > Email address in php regular string e-mail_PHP tutorial

Email address in php regular string e-mail_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-20 11:02:32
Original
1223 people have browsed it

If you are verifying your email, the first one is good. If you want to get whether there is an email address in an article or string, you can use the second one.
*/
function funcemail($str)//Mailbox regular expression
{
return (preg_match('/^[_.0-9a-z-a-z-]+@([0-9a-z][0-9a-z-]+.)+[a-z]{2,4}$/' ,$str))?true:false;
}

/*
PHP tutorial filter_sanitize_email filter
The filter_sanitize_email filter removes all illegal e-mail characters from a string.

This filter allows all characters, numbers, and $-_.+!*'{}|^~[]`#%/?@&=.

*/

$var="some(one)@example.com";

var_dump(filter_var($var, filter_sanitize_email));

//string(19) "someone@example.com"


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/445375.htmlTechArticleIf you are the first one to verify the email, it is good. If you want to get whether there is an email address in the article or string, You can use the second one. */ function funcemail($str)//Mailbox regular expression { re...
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 data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
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