You seem to have XML data, not just text data. Please use the right tool for the job. XML should be read and interpreted using XML tools, not text tools like Regex or plain text parsing. Even if the regex answer works in this example, it is not right!
XML stands for EXTENSIBLE Markup Language. This means that the XML file content should be EXTENSIBLE without breaking the processing of the XML file. If you hard code the reading with regex or plain text, your integration will break when the XML changes. With xml tools used correctly this is not a problem. Of course you could count on that nothing will change in the future, but this has many times proven to be wrong assumption.
Odoo uses XML heavily. Odoo uses XML the correct way. When coding in Odoo, please also use XML correctly.
In Daniele Murer's answer you can find the right way to do it. Please use it.
For more information on processing xml in python, take a look at https://www.tutorialspoint.com/python3/python_xml_processing.htm, or search for "python xml" in Google.