note 14487 deleted from function.ereg-replace by jimw

From: Date: Fri, 02 Nov 2001 01:58:58 +0000
Subject: note 14487 deleted from function.ereg-replace by jimw
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-20216@lists.php.net to get a copy of this message
Dilemma: Encoding and Decoding text to URL and mail hyperlinks. I found lots of different ways to encode a hyperlink from text, but not one example of reversing the process, so... // Replace tekstlink with HyperLink $Text = ereg_replace('www+(\.[[:alnum:]~_-]+)+([/\.][[:alnum:]?&=~_-]+)*/*', '<A HREF="http://\\0" TARGET="_blank">\\0</A>', $Text); // Replace mailtext with HyperLink $Text = ereg_replace('[A-Za-z0-9]([A-Za-z0-9._]*[A-Za-z0-9]|())@[A-Za-z0-9]([A-Za-z0-9.\-]*[A-Za-z0-9]|())\.[A-Za-z]+', '<A HREF="mailto:\\0">\\0</A>', $Text); // Remove hyperlink $Text = ereg_replace('<A HREF="http://www+(\.[[:alnum:]~_-]+)+([/\.][[:alnum:]?&=~_-]+)*/*" TARGET="_blank">|</A>', '', $Text); // Remove maillink $Text = ereg_replace('<A HREF="mailto:+[A-Za-z0-9]([A-Za-z0-9._]*[A-Za-z0-9]|())@[A-Za-z0-9]([A-Za-z0-9.\-]*[A-Za-z0-9]|())\.[A-Za-z]+">|</A>', '', $Text);

« previous php.notes (#20216) next »