My Code:
<?php
$fullDoc = "<HEAD><TITLE>TEST DOC</TITLE></HEAD><BODY><UL><LI><A HREF='mike.html'><H3>Test Link</H3></A></LI></UL></BODY>";
$pat = "/<A(.+)HREF=(?:\"')(?:\"')>/Ui";
$repl = "<A HREF=\"http://www.myserver.com/parse.php?url=$url&link=\2\" \1 \3>";
$new=preg_replace($pat, $repl, $fullDoc);
print $new;
?>
Ok, I want to find all Anchor links are replace them with $repl. Simpple enough. I need to account for all differnt anchor conventions though, which would be: Tags between <A and HREF, HREF='link', HREF="link", HREF=link, and tags after the HREF (i.e. TARGET="top").
It all works like a CHARM, except it does NOT match if the are not quotes in the href, example. <A TARGET="TOP" HREF"=link.html" NAME=Link1> works, but <A TARGET="_TOP" HREF=link.html NAME=Link1> with out the quotes doesn't work... Anyone help me here?
Thanks ALOT!!!
mike