ereg_replace
| From: | Bobo Wieland | Date: | Wed, 12 Feb 2003 19:42:46 +0000 |
| Subject: | ereg_replace | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-18496@lists.php.net to get a copy of this message | ||
I'm using ereg_replace to find urls as said in the manual. I've changed it a
tiny litte bit to remove the http:// part when displaying the link, like
this:
$str = ereg_replace("([[:alpha:]]+://)([^<>[:space:]]+[[:alnum:]/])","<a
href='\\0' class='red' target='_blank'
onfocus='this.blur()'>\\2</a>",
$str);
I'm trying to get the grips of regular expressions but I can't figure this
one out; If the url includes a query-string I don't want it to be shown. So
the url
http://www.elstudion.com/index.php?foo=bar
should be replaced with:
<a
href='http://www.elstudion.com/index.php?foo=bar'>www.elstudion.com/index.ph
p</a>
How do I do this?
Thanks!
.bobo