regular expression

Fredrik Lundh effbot at telia.com
Thu Feb 24 17:53:35 CET 2000


courtneyb <courtneyb at big-c.com> wrote:
> After running this I get...<re.MatchObject instance at 80f0ff0>
>
> How do u return the content between the pre tags?

reading the fine manual could help:

http://www.python.org/doc/current/lib/match-objects.html

in this case, change your function to return
result.group() instead of just result (but only
if result is not None), e.g:

    if result:
        return result.group() # matched string
    return None # no match

</F>





More information about the Python-list mailing list