I’m using etree module. I’m trying to extract the information around <text ...> tag. Here is my XML file. I want if <text ...">{{Infobox film start with Infobox film then copy all the text between {{ }}. Is it possible? thanks
Update: XML file updated
The following snippet should do what you want:
The regular expression there begins with
(?s), which turns on theDOTALLoption, meaning that.matches newlines as well as any other character. The two instances of.*?are non-greedy matches of any charcter – i.e. they will find the shortest stretch of zero or more characters until the rest of the expression can be matched.