Re: Removing link on the fly, but leave link text
| From: | Jo�o C�ndido de Souza Neto | Date: | Tue, 31 Aug 2010 20:11:11 +0000 |
| Subject: | Re: Removing link on the fly, but leave link text | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-307787@lists.php.net to get a copy of this message | ||
Try this:
$pattern = array(
"/<a [^>]/",
"/</a>/"
);
preg_replace($pattern, "", $text);
--
João Cândido de Souza Neto
"Karl DeSaulniers" <karl@designdrumm.com> escreveu na mensagem
news:007BC8E1-B2C8-4DD5-9D18-EB07B0D55C0E@designdrumm.com...
> Hi,
> Say I have some text.
>
> $text = 'You can logon here: <a href="http://website.com/shop/
> index.php?username='.$username.'">http://website.com/shop/index.php?
> username='.$username.'</a>. This link will take you to your web
> browser to login.'.$eol;
>
> I want to be able to strip the "<a href="http://website.com/shop/
> index.php?username='.$username.'">" and </a>.
> Leaving just the http://website.com/shop/index.php?username='.
> $username.' text, so it would end up like.
>
>
> $text = 'You can logon here: http://website.com/shop/index.php?
> username='.$username.'. This link will take you to your web browser
> to login.'.$eol;
>
> I have tried MANY different ways and have no success.
> Can anyone help me?
> TIA
>
>
> Karl DeSaulniers
> Design Drumm
> http://designdrumm.com
>
>