Let's say i've got a html-doc with lot's of links and want to add target=_blank on these.....how would i do this using PHP. I tried using preg_replace but i need to learn a thing or two about regular expressions first i guess......know a good site for this let me know.
-Stig
Try this :
$res=preg_replace("/<(.*)>/Us","<\1 target=_blank>",$s);
A good place to learn is... this forum ! Do a search on "regexp" and you'll find tons of examples. The PHP manual is useful too, even though not very didactic.
My previous regexp was processing all tags, try rather this :
$res=preg_replace("/<(A .*)>/Usi","<\1 target=_blank>",$s);
There is an easier way: just add <BASE target="_blank"> to a <HEAD> block and all links will have that target set