Ugly Joe
New member
I'm trying to make a regular expression that will append a path to all relative links on a webpage. That is:
<a href="blah/blah2/page.htm">page<a>
would be replaced with something like:
<a href="/newdir/deeperdir/blah/blah2/page.htm">page<a>
I can find all the links and add the extra path information. My problem is that I can't discern between relative and absolute links. That is, I don't want:
<a href="http://zophar.net">page<a>
to become:
<a href="/newdir/deeperdir/http://zophar.net">page<a>
I've been trying to figure out how to add a "not ://" or "not http|ftp|mailto" clause to the regex, but I can't figure out a way to do it. Can any regex gurus out there lend me hand?
<P ID="signature">_______________________________________
</P>
<a href="blah/blah2/page.htm">page<a>
would be replaced with something like:
<a href="/newdir/deeperdir/blah/blah2/page.htm">page<a>
I can find all the links and add the extra path information. My problem is that I can't discern between relative and absolute links. That is, I don't want:
<a href="http://zophar.net">page<a>
to become:
<a href="/newdir/deeperdir/http://zophar.net">page<a>
I've been trying to figure out how to add a "not ://" or "not http|ftp|mailto" clause to the regex, but I can't figure out a way to do it. Can any regex gurus out there lend me hand?
<P ID="signature">_______________________________________
