PHow to replace line break between specific tag in XML

     

i have a very long XML source file stored in $Result which contains amongst other tags multiple tags named uid1 and uid20.


   Line 1   Line 2   Line 3   Line 4      Line 1   Line 2   Line 3   Line 4           Line 1   Line 2   Line 3   Line 4      Line 1   Line 2   Line 3   Line 4        ...  

I need to replace all line breaks between those two tags with a semicolon but leave all other line breaks untouched. I tried preg_replace and could not get it to work