I would just cut the text off via explode at the ? mark.

i.e.:

$shorturl = explode("?", $str, 1); //may or may not work...

then echo $shorturl[0];

-Dash

Sturgeon's Law:
        90% of everything is crud.

On Wed, 12 Feb 2003, Bobo Wieland wrote:

> 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
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to