Hacker News new | ask | show | jobs
by misterdata 3944 days ago
Warp [1] implements this, and also allows you to generate a list of all possible values matching a particular regex (the number of possibilities of course grows quite quickly for many regexes!).

[1] https://itunes.apple.com/us/app/warp/id973942134?mt=12

2 comments

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)
That's cool, thanks. I've discovered sre_parse thanks to that link, so cool too.
I've made a node package that does the same thing, a few years ago: https://github.com/arcanis/pxeger

I mainly used it to generate test mail addresses. For example, the following will generate 36 test email addresses:

    (blue|red|yellow|green).(oak|cedar|willow)@(yahoo.co.uk|google.com|example.org)