Exrex does the same in Python and much more:
- Generating all matching strings
- Generating a random matching string
- Counting the number of matching strings
- Simplification of regular expressions
https://github.com/asciimoo/exrex (AGPL licensed)