i'm trying to create a script that transform all the relative paths to absolute paths
so how can I find and replace in a html text all the occurences of
src="/jsfile.js
with
src="http://mysite.com/jsfile.js
then
src="../jsfile.js
with
src="http://mysite.com/jsfile.js
and then
src="js/jsfile.js
with
src="http://mysite.com/js/jsfile.js
and maybe more cases? well of course also the href scenarios
UPDATE
maybe my question was bad written, but the goal is to replace any relative url or relative link to an absolute url... i'm not sure if the answers below are working