I have a xml document with some repeating tags. Simple example goes like:
<dog>
<cat>
...
<dog>
<cat>
...
<dog>
<cat>
A sample regex for this example is <dog>\s+<cat>
which matches each tag combo. That's what I initially want. My question is if I wanted to do substitution (capture group and back reference) but DON'T want to replace each matching pattern with the same value how do I specify? Like in the example above what if I wanted to replace each tag combo with something like:
<monkey>
<cat>
...
<elephant>
<cat>
...
<lion>
<cat>
I guess in general is there a way to make a substitution non-global? I believe I read that without global substitution it'll only replace the 1st matching pattern. I could use that technique to replace each tag one by one but wanted to know if there was a better solution. The goal is to use the linux sed command but I've been testing in Notepad++.