Python regex question

Tim N. van der Leeuw tnleeuw at
Fri Aug 15 13:47:39 CEST 2008

Hey Gerhard,

Gerhard Häring wrote:
> Tim van der Leeuw wrote:
>> Hi,
>> I'm trying to create a regular expression for matching some particular 
>> XML strings. I want to extract the contents of a particular XML tag, 
>> only if it follows one tag, but not follows another tag. Complicating 
>> this, is that there can be any number of other tags in between. [...]
> Sounds like this would be easier to implement using Python's SAX API.
> Here's a short example that does something similar to what you want to 
> achieve:
> [...]

I so far forgot to say a "thank you" for the suggestion :-)

The sample code as you sent it doesn't do what I need to do, but I did look
at it for creating SAX handler code that does what I want.

It took me a while to implement, as it didn't fit in the parser-engine I had
and I was close to making a release.

But still: thanks!


View this message in context:
Sent from the Python - python-list mailing list archive at

More information about the Python-list mailing list