php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #17504 Returning all email addresses found in a string with preg_match_all
Submitted: 2002-05-29 05:49 UTC Modified: 2002-06-28 03:19 UTC
From: toby dot beresford at ship-uk dot com Assigned:
Status: Not a bug Package: Documentation problem
PHP Version: 4.2.1 OS: Linux
Private report: No CVE-ID: None
 [2002-05-29 05:49 UTC] toby dot beresford at ship-uk dot com
This code searches a string and returns all the email addresses in it.

preg_match_all("(([a-z0-9_]|\\-|\\.)+@(([a-z0-9_]|\\-)+\\.)+[a-z]{2,4})",$StringToSearch,$matches);

for ($b=0; $b<sizeof($matches[0]); $b++) {
	echo $matches[0][$b]."<br>";
}

-toby

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-05-29 06:15 UTC] cynic@php.net
Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.php.net/how-to-report.php

If you can provide more information, feel free to add it
to this bug and change the status back to "Open".

Thank you for your interest in PHP.

 [2002-05-29 06:21 UTC] sander@php.net
What do you want us to do with this?
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 05 14:01:31 2024 UTC