suppose that I download many html pages to the directory
/path/to/my/dir
the .html pages contain links like :
"<a href="http://www.example.com/lessons/firstlesson.htm">first lesson</a>"
"<a href="http://www.example.com/lessons/secondlesson.htm">second lesson</a>"
Thanks to TobSpr , the answer convert them as follow :
"<a href="/path/to/my/dir/firstlesson.htm">first lesson</a>"
"<a href="/path/to/my/dir/secondlesson.htm">second lesson</a>"
UPDATE
but how to deal with this format of links : "first lesson"
"<a href="../index.htm">index</a>"
Using the usual string functions is very difficult , dirty and buggy , So I hope to get another beter way .