Thanks I've got that working to fix the URL properly.
Thing is, the input that I have is a chunk of HTML code, not just the URLs by themselves. I need to search for each URL and then fix it and replace it in the chunk of code. I think I could search for anything begining with
="index.php? and ending in a double quote but I don't know
how to do it (as in <a href="index...">, <img src=").