Hi, I have the HTML in the form of a string and before I display it in the browser, I want to change all the relative urls on the page to absolute urls. How can I do it the best way? I was thinking of Regex as an option to get the href attributes of anchor tags and append the base url to it, but not sure how to do it? Can someone help or suggest a better solution?
PS: I want to exclude all the links that have only "#" symbol in the link. For example: I want to replace <a href="/dir/file1.htm" />
with <a href="http://mysite/dir/file1.htm" />
but I want to exclude <a href="#A1" />
I would appreciate any help on this.