need help with re module

Matimus mccredie at
Wed Jun 20 22:27:03 CEST 2007

Here is an example:

>>> s = "<html>Hello</a>world<anytag>ok"
>>> matchtags = re.compile(r"<[^>]+>")
>>> matchtags.findall(s)
['<html>', '</a>', '<anytag>']
>>> matchtags.sub('',s)

I probably shouldn't have shown you that. It may not work for all
HTML, and you should probably be looking at something like


More information about the Python-list mailing list