Stripping <A HREF tags
Posted: Tue Feb 28, 2006 6:09 pm
Hey All,
I'm trying to parse HTML documents and remove all the hyperlinks while keeping the linked text. Here's what I'm trying:
function stripHref($string)
{
return preg_replace('/<[aA][^<]*href=["|\']?([^ "\']*)["|\']?[^>].*>([^<]*)</a>/i',' \\3', $string);
}
It's returning nothing but I cannot figure out why.
Any help would be great.
Thanks
I'm trying to parse HTML documents and remove all the hyperlinks while keeping the linked text. Here's what I'm trying:
function stripHref($string)
{
return preg_replace('/<[aA][^<]*href=["|\']?([^ "\']*)["|\']?[^>].*>([^<]*)</a>/i',' \\3', $string);
}
It's returning nothing but I cannot figure out why.
Any help would be great.
Thanks