Forum Moderators: coopster

Message Too Old, No Replies

Handling relative links in a string

         

Jordo needs a drink

5:12 am on Nov 9, 2006 (gmt 0)

10+ Year Member



Hoping someone can help me. I'm assuming this is an ereg solution and I'm terrible at ereg.

I need to search a string and replace relative links like

<a href="/example/example.php">
with it's absolute url with the domain of $domain so it is
<a href="http://$domain/example/example.php">

The string has both absolute url's and relative url's, so I can't just add $domain to all of them.

What's the best way to do this?

Jordo needs a drink

3:04 pm on Nov 9, 2006 (gmt 0)

10+ Year Member



Nevermind, I was making it harder than it really was.

eelixduppy

2:39 pm on Nov 10, 2006 (gmt 0)



Glad you found the solution! Sometimes you just have to step back and look at everything that you have ;)