note 22807 added to function.ereg-replace

From: Date: Mon, 01 Jul 2002 03:17:22 +0000
Subject: note 22807 added to function.ereg-replace
Groups: php.notes 
Request: Send a blank email to php-notes+get-32449@lists.php.net to get a copy of this message
If you want to add the corresponding <a href> tag to an e-mail you may do: ereg_replace ('[_a-zA-z0-9\-]+(\.[_a-zA-z0-9\-]+)*\@' . '[_a-zA-z0-9\-]+(\.[a-zA-z]{1,3})+', '<a href="mailto:\\0">\\0</a>', $txt); It is possible that this may be done better, but it actually works for me, and also supports e-mails with domains like .co.uk and users with dots in their names, for example: john.master_mind@domain.co.uk Note: I break the pattern into two substrings because the PHP notes system isn't allowing me to write this long line. You should keep the pattern just in one string. -- http://www.php.net/manual/en/function.ereg-replace.php http://master.php.net/manage/user-notes.php?action=edit+22807 http://master.php.net/manage/user-notes.php?action=delete+22807 http://master.php.net/manage/user-notes.php?action=reject+22807

« previous php.notes (#32449) next »