Hello,
I am having trouble matching a bit of text with a regular expression. I am kind of new to regex, so I was wondering if someone could help me out.
I have several <a href="... tags that I want to match and add a "../" in front of each href UNLESS it is an absolute link (href="http://www.google.com")
I used the regex
/<a href="/ with a preg_replace() to replace it with <a href="../
But that also adds the ../ to absolute links (which breaks them). How can I write a regex to say MATCH the <a href=" only if there is NOT an http: following it?
Thanks for any help. Please let me know if you need clarification.