Bug #17504: Returning all email addresses found in a string with preg_match_all
| From: | toby dot beresford at ship-uk dot com | Date: | Wed, 29 May 2002 09:49:15 +0000 |
| Subject: | Bug #17504: Returning all email addresses found in a string with preg_match_all | ||
| Groups: | php.bugs php.doc | ||
| Request: | Send a blank email to php-bugs+get-8834@lists.php.net to get a copy of this message | ||
From: toby.beresford@ship-uk.com
Operating system: Linux
PHP version: 4.2.1
PHP Bug Type: Documentation problem
Bug description: Returning all email addresses found in a string with preg_match_all
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
--
Edit bug report at http://bugs.php.net/?id=17504&edit=1
--
Fixed in CVS: http://bugs.php.net/fix.php?id=17504&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=17504&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=17504&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=17504&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=17504&r=support
Expected behavior: http://bugs.php.net/fix.php?id=17504&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=17504&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=17504&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=17504&r=globals