Multiline python regex
问题 I have a file structured like this : A: some text B: more text even more text on several lines A: and we start again B: more text more multiline text I'm trying to find the regex that will split my file like this : >>>re.findall(regex,f.read()) [('some text','more text','even more text\non several lines'), ('and we start again','more text', 'more\nmultiline text')] So far, I've ended up with the following : >>>re.findall('A:(.*?)\nB:(.*?)\n(.*?)',f.read(),re.DOTALL) [(' some text', ' more