In your example your tags aren't balanced. Is it just the first open <tag> you are trying to replace, or also change a closing </tag> with possible other <tag></tag> inside?
I have multiple occurrences of <tag>..</tag> in data but want to only rename the the first occurrence of opening and closing to something else. They are not inside each other.