Re: strip urls

From: Date: Mon, 11 Sep 2006 16:54:10 +0000
Subject: Re: strip urls
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-241609@lists.php.net to get a copy of this message
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

« previous php.general (#241609) next »