For Programmers: Free Programming Magazines  


Home > Archive > PHP Language > January 2006 > strip URL's









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author strip URL's
Bruno

2006-01-10, 4:00 am

Hi there,

I want to strip any urls from a page and show the page without those links.
My solution is sort of lenghly. Looking for a nice and smart solution. Any
ideas?

Regards
Bruno


Lüpher Cypher

2006-01-10, 4:00 am

Bruno wrote:
> Hi there,
>
> I want to strip any urls from a page and show the page without those links.
> My solution is sort of lenghly. Looking for a nice and smart solution. Any
> ideas?
>


I'd use preg_replace, something like

$content = preg_replace("/<[aA]\s+.*>/","",$content);
$content = preg_replace("/</[aA]>/","",$content);




--

- lüpher
---------------------------------------------
"Man sieht nur das, was man weiß" (Goethe)
Jim Michaels

2006-01-16, 7:56 am

this should work with xhtml also.
$content = preg_replace("m#</?[aA](\s[^\>]*|)>#","",$content);

"Lüpher Cypher" <lupher.cypher@verizon.net> wrote in message
news:9wBuf.5470$i%4.3574@trndny08...
> Bruno wrote:
>
> I'd use preg_replace, something like
>
> $content = preg_replace("/<[aA]\s+.*>/","",$content);
> $content = preg_replace("/</[aA]>/","",$content);
>
>
>
>
> --
>
> - lüpher
> ---------------------------------------------
> "Man sieht nur das, was man weiß" (Goethe)



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com