Python Regex Question
malteseunderdog at gmail.com
Wed Oct 29 19:29:08 CET 2008
Hi there I just started python (but this question isn't that trivial
since I couldn't find it in google :) )
I have the following text file entries (simplified)
start #frag 1 start
x=Dog # frag 1 end
start # frag 2 start
x=Cat # frag 2 end
start #frag 3 start
x=Dog #frag 3 end
I need a regex expression which returns the start to the x=ANIMAL for
only the x=Dog fragments so all my entries should be start ...
(something here) ... x=Dog . So I am really interested in fragments 1
and 3 only.
My idea (primitive) ^start.*?x=Dog doesn't work because clearly it
would return results
x=Dog # (good)
x=Dog # bad since I only want start ... x=Dog portion
Can you help me ?
More information about the Python-list