Home  >  Article  >  Backend Development  >  PHP implements regular expression extraction email address function

PHP implements regular expression extraction email address function

WBOY
WBOYOriginal
2016-07-25 08:45:28899browse
  1. function extract_emails_from($string) {
  2. //Add judgment on #, you know this ^_^ http://blog.ddian.cn
  3. preg_match_all("/[._a-zA-Z0-9 -]+(@|#)[._a-zA-Z0-9-]+/i", $string, $matches);
  4. return $matches[0];
  5. }
Copy code

Regular expressions, PHP, email


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