Re: - ereg_replace -SOLVED
| From: | ΝΙΚΟΣ ΓΑΤΣΗΣ | Date: | Fri, 14 Nov 2003 15:24:16 +0000 |
| Subject: | Re: - ereg_replace -SOLVED | ||
| References: | 1 2 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-31579@lists.php.net to get a copy of this message | ||
Thank you all for the replies.
I solve it with the following code:
eregi_replace("<a href=\"(.+)\">", "<a href=\"\\1\"
target=\"_blank\"
class=\"down_txt\">", $body);
----- Original Message -----
From: "John W. Holmes" <holmes072000@charter.net>
To: "ΝΙΚΟΣ ΓΑΤΣΗΣ" <nikos@qbit.gr>
Cc: "PHP-mailist" <php-db@lists.php.net>
Sent: Friday, November 14, 2003 3:25 PM
Subject: Re: [PHP-DB] - ereg_replace
> ΝΙΚΟΣ ΓΑΤΣΗΣ wrote:
>
> > I'm trying to replace the string say <a
> > href="http://www.mysite.gr">
> > with <a href=http://www.mysite.gr
> > target="_blank"> with no luck
> >
> > I use the code:
> >
> > ereg_replace("^<a href=\"([:alnum:])\">$", "<a
> > href=\"\\1\"
> > target=\"_blank\">", $string)
>
> Since it looks like you're changing all of the links, how about a simple
> str_replace() replacing '<a' with '<a target="_blank"' ??
>
> --
> ---John Holmes...
>
> Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
>
> php|architect: The Magazine for PHP Professionals - www.phparch.com
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>