note 29597 added to function.eregi-replace
| From: | php at silisoftware dot com | Date: | Tue, 18 Feb 2003 17:08:28 +0000 |
| Subject: | note 29597 added to function.eregi-replace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-44163@lists.php.net to get a copy of this message | ||
Transform HTML links into plain-text "links" with the URL visible
function AHREF2text($string) {
return eregi_replace('<A .*HREF=("|\')?([^
"\']*)("|\')?.*>([^<]*)</A>', '[\\4] (link: \\2)',
$string);
}
$HTMLstring = 'A link to <a href="http://www.php.net">PHP.net</A>';
echo AHREF2text($HTMLstring);
// prints: A link to [PHP.net] (link: http://www.php.net)
--
http://www.php.net/manual/en/function.eregi-replace.php
http://master.php.net/manage/user-notes.php?action=edit+29597
http://master.php.net/manage/user-notes.php?action=delete+29597
http://master.php.net/manage/user-notes.php?action=reject+29597