I forget how to find multiple instances of stuff between tags using
regular expressions. Specifically I want to find all the text between a
series of begin/end pairs in a multiline file.
I tried:[color=blue][color=green][color=darkred]
>>> p = 'begin(.*)end'
>>> m = re.search(p,s,r e.DOTALL)[/color][/color][/color]
and got everything between the first begin and last end. I guess
because of a greedy match. What I want to do is a list where each
element is the text between another begin/end pair.
TIA
David Lees
regular expressions. Specifically I want to find all the text between a
series of begin/end pairs in a multiline file.
I tried:[color=blue][color=green][color=darkred]
>>> p = 'begin(.*)end'
>>> m = re.search(p,s,r e.DOTALL)[/color][/color][/color]
and got everything between the first begin and last end. I guess
because of a greedy match. What I want to do is a list where each
element is the text between another begin/end pair.
TIA
David Lees
Comment