OK, I see the problem here. Mainly its because I used [\s\S]* to match an unlimited number of characters. The problem is that [\s\S] matches anything
, including new line characters and so if there is no match where I'm expecting it (within the <Line> </Line> delimiters), it will carry on looking until it reaches the end of file.
So I've replaced it with a search for a limited number of lines and this appears to work better.
In "replace with" put $1.