Regular Expressions: Can't quite figure this problem out

Miles semanticist at
Tue Sep 25 17:48:23 CEST 2007

On 9/25/07, Paul McGuire wrote:
> On Sep 24, 11:23 pm, Gabriel Genellina wrote:
> > py> print re.sub(r"<(\w+)([^>]*)></\1>", r"<\1\2 />", source)
> And let's hope the OP doesn't have to parse anything truly nasty like:
> <esolang:language name="Python" interpreter_prompt=">>>"></
> esolang:language>

Or something mildly nasty, like <foo><foo/></foo>


More information about the Python-list mailing list