03-22-2010, 07:29 AM
|
#1 (permalink)
|
|
The Wanderer
Join Date: Mar 2010
Posts: 9
Thanks: 2
|
Stuck with regexps in HTML again
Hi everyone:
I'm stuck with regular expressions again. Here's what I'm trying to accomplish. I need to add target=_blank to every hyperlink in the HTML. I use the following PHP code:
PHP Code:
$txt = preg_replace("/<a\s+(.+)>/i", "<a \\1 target=_blank>", $txt);
But that seems to add it only to </a> tags. Why?
|
|
|
|