Re: strip urls

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



RalfGesellensetter schrieb:
Am Montag 11 September 2006 15:36 schrieb Merlin:
I am trying to strip URL's out of a text. There is a function for
this in php, but I can't find it anywhere. Can sombody help?

hi, it's strip_tags and only removes the tags (<a href ...) but keeps the plain text that would be displayed in a text browser.

Hi there,

thank you for the hint. This it the one I was searching for. However unfortunatelly the function also strips all other tags! I am looking for one that only does strip the <a href tag.

I am not so familar with regex, but I fear I would need to :-(

My guess is that it must be something like this:

$str = 'foo  <a href="">test</a> o';
$str = preg_replace('<a (.*)', '', $str);
echo $str;

Can anybody help me on that? Thank you so much in advance.

Regards,

Merlin

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux