I'm trying to work out a regex that will do this:

Take an entire page's html: my $html_code; # all lines in thes one variable

And make any href's that are relative absolute by prepending $url into them:
        $url = "http://myclonesite.com";;
        make <a href="./documents/help.hml"> into <a 
href="http://myclonesite.com/documents/help.html";>
        $html_code =~ s/href\=\"\.?\/?(.*)\"/href\=\"$url\/"/ig;
        the rpobolem with this is it prepends $url to absolute url's also

I need to say :
Put $url in front of relative urls (make ./foo /foo or foo $url/foo and ../foo would 
have to be treated differently, ignored for now) in href if href does not start with 
https?://

Any ideas?

TIA
Dan


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to