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@xxxxxxxxxxx> To: "ΝΙΚΟΣ ΓΑΤΣΗΣ" <nikos@xxxxxxx> Cc: "PHP-mailist" <php-db@xxxxxxxxxxxxx> Sent: Friday, November 14, 2003 3:25 PM Subject: Re: - 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 > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php