Well, either you learn the basics of regex syntax and use re
, or you have a look at the Python's xml.etree.ElementTree
module to parse the xml directly.
If you want to go with a regex, you can test language-specific expressions interactively with online tools, regex101 for example.
Maybe <(?P<method>\w*?) (?P<code>\w*?)=\"(?P<value>.*)\">
will do the job.
But once again, as mentioned, extracting data from XML using regex is fragile and very limited.
EDIT: Clearer explanation for 3
EDIT2: Add regex suggestion