I am working on a site templating script, and most of it works, but now I want to recode it so that it can iterate through the file (and any files that are loaded via SSI, my program handles the SSI's internally), and find any "local" links (ones with /, ./, ../, or www.mysite.com in the beginning of the link), and append "dotemplate.php?page=" to the beginning of thse links. External links should NOT have this.
I was thinking about how to do this as a regular expression, but my mind is blank. Any pointers would be great.
Thanks in advance