Stupid Regex Question

Fredrik Lundh fredrik at pythonware.com
Wed Apr 21 12:43:40 EDT 2004


Jonas Galvez wrote:

> I'm feeling dumb:
>
> str = "<tag>text<innertag>moretext</innertag></tag><tag>text</tag>"
>
> How can I get a list like ["text<innertag>moretext</innertag>",
> "text"] using regexes? I'm starting to believe it's not possible.

print re.findall("<tag>(.*?)</tag>", str)

</F>







More information about the Python-list mailing list