How to print SRE_Pattern (regexp object) text for debugging purposes?

dmtr dchichkov at gmail.com
Thu Jun 17 18:49:45 EDT 2010


On Jun 17, 3:35 pm, MRAB <pyt... at mrabarnett.plus.com> wrote:
>
>  >>> import re
>  >>> r = re.compile('^abc$', re.I)
>  >>> r.pattern
> '^abc$'
>  >>> r.flags
> 2


Hey, thanks. It works.

Couldn't find it in a reference somehow.
And it's not in the inspect.getmembers(r).
Must be doing something wrong.....

-- Cheers, Dmitry



More information about the Python-list mailing list