ereg_replace
| From: | Mitch Tishaw | Date: | Mon, 18 Feb 2002 20:44:59 +0000 |
| Subject: | ereg_replace | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-85281@lists.php.net to get a copy of this message | ||
I need a little help with the ereg_replace function. I have the following code:
$text = ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]","<a
href=\"\\0
\">\\0</a>", $text);
which pads a url with an href tag to make it clickable. Here's what I would
like to do: In the case of the url ending with .gif or .jpg, I would like to
pad it with an img src tag instead, so it shows up as an actual picture. Does
anyone know how I can modify the above code to do this? Thanks in advance.
Mitch