View Single Post
Old 03-22-2010, 07:29 AM   #1 (permalink)
dc2000
The Wanderer
 
Join Date: Mar 2010
Posts: 9
Thanks: 2
dc2000 is on a distinguished road
Default 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?
dc2000 is offline  
Reply With Quote