Joel Hedlund enlightened us with:
> regexp = re.compile(r"<(tag1)>(.*)</\1>")

I'd go for

regexp = re.compile(r"<(tag1)>(.*?)</\1>")

Otherwise this:

line = "<tag1>sometext</tag1><tag1>othertext</tag1>"
match = regexp.search(line) 

will result in 'sometext</tag1><tag1>othertext'

Sybren
-- 
The problem with the world is stupidity. Not saying there should be a
capital punishment for stupidity, but why don't we just take the
safety labels off of everything and let the problem solve itself? 
                                             Frank Zappa
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to