python - Regexp extract XML attribute value -
this question has answer here:
please, advice how xml attribute value regexp python style.
here example, extract has full match(long story)
<method code="abc"> the achieved (?<=code=\")(.*?)(?=\">), ignores method part @ all
thanks
well, either learn basics of regex syntax , use re, or have @ python's xml.etree.elementtree module parse xml directly.
if want go regex, can test language-specific expressions interactively online tools, regex101 example.
maybe <(?p<method>\w*?) (?p<code>\w*?)=\"(?p<value>.*)\"> job. once again, mentioned, extracting data xml using regex fragile , limited.
edit: clearer explanation 3
edit2: add regex suggestion
Comments
Post a Comment