LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

exrex

reverse regex matching string generator

TLDR

Generate all strings matching a regex
$ exrex '[a-z]{2}'
copy
Generate a single random matching string
$ exrex -r '[A-Za-z0-9]{8}'
copy
Count the number of matching strings
$ exrex -c '[0-9]{3}'
copy
Limit the range size for unbounded quantifiers (+, *)
$ exrex -l [5] '[0-9]+'
copy
Cap the maximum number of generated strings
$ exrex -m [10] '[a-z]+'
copy
Use a custom output delimiter
$ exrex -d ', ' '[ab]{2}'
copy

SYNOPSIS

exrex [options] regex

DESCRIPTION

exrex is a command-line tool and Python library that generates all or random strings matching a given regular expression. It's useful for testing, fuzzing, and generating sample data.The tool parses regex patterns and produces strings that would match, rather than matching existing strings. It supports most common regex features including character classes, quantifiers, groups, and alternation.exrex is particularly useful for generating test inputs, creating wordlists, or understanding what patterns a regex would match.

PARAMETERS

REGEX

Regular expression pattern to generate strings from.
-r, --random
Return a single random string that matches the regex.
-c, --count
Print the number of matching strings instead of the strings.
-l N, --limit N
Maximum range size for unbounded quantifiers (+, *). Default is 20.
-m N, --max-number N
Maximum number of strings to generate. Default is -1 (all).
-o FILE, --output FILE
Write output to FILE instead of standard output.
-d DELIM, --delimiter DELIM
Output delimiter (default newline).
-s, --simplify
Simplify the regular expression.
-v, --verbose
Verbose mode.
--help
Display help information.

CAVEATS

Unlimited quantifiers (*, +) are bounded by default. Complex patterns may generate massive output. Not all regex features supported. Memory usage scales with output size.

HISTORY

exrex is a Python-based regex string generator created for testing and security research, providing reverse regex matching capabilities for generating test data and wordlists.

SEE ALSO

grep(1), sed(1), python(1)

RESOURCES

Braincup
Open source brain training for math, memory and focus
Braincup mini-games
41 mini-games · Apache-2.0
No ads · No tracking
Play in browser
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid
276 stars
From the maker of Linux Command Library
Copied to clipboard
Braincup
Open source brain training for math, memory and focus. 41 mini-games, from mental arithmetic to Sudoku, N-Back and Solo Chess.
Apache-2.0 licensed · No ads · No tracking · No account
From the maker of Linux Command Library
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid