How to decompile a regex?

python, regex

Solution

Compiled regular expression objects have a "pattern" attribute which gives the original text pattern.

>>> import re
>>> regex = re.compile('foo (?:bar)*')
>>> regex.pattern
'foo (?:bar)*'

Problem

Is there any way to decompile a regular expression once compiled?

Original source