HiveBrain v1.2.0
Get Started
← Back to all entries
snippetbashTip

exrex — Generate all/random matching strings for a `regex`. It can also simplify `regex`es. More information

Submitted by: @import:tldr-pages··
0
Viewed 0 times
commandstringsallexrexclirandommatchinggenerate

Problem

How to use the exrex command: Generate all/random matching strings for a regex. It can also simplify regexes. More information: <https://github.com/asciimoo/exrex#usage>.

Solution

exrex — Generate all/random matching strings for a regex. It can also simplify regexes. More information: <https://github.com/asciimoo/exrex#usage>.

Generate all possible strings that match a regex:
exrex '{{regex}}'


Generate a random string that matches a regex:
exrex {{[-r|--random]}} '{{regex}}'


Generate at most 100 strings that match a regex:
exrex {{[-m|--max-number]}} {{100}} '{{regex}}'


Generate all possible strings that match a regex, joined by a custom delimiter string:
exrex {{[-d|--delimiter]}} "{{, }}" '{{regex}}'


Print count of all possible strings that match a regex:
exrex {{[-c|--count]}} '{{regex}}'


Simplify a regex:
exrex {{[-s|--simplify]}} '{{ab|ac}}'


Print eyes:
exrex '{{[oO0](_)[oO0]}}'


Print a boat:
exrex '{{( {20}(\| *\\|-{22}|\|)|\.={50}| ( ){0,5}\\\.| {12}~{39})}}'

Code Snippets

Generate all possible strings that match a `regex`

exrex '{{regex}}'

Generate a random string that matches a `regex`

exrex {{[-r|--random]}} '{{regex}}'

Generate at most 100 strings that match a `regex`

exrex {{[-m|--max-number]}} {{100}} '{{regex}}'

Generate all possible strings that match a `regex`, joined by a custom delimiter string

exrex {{[-d|--delimiter]}} "{{, }}" '{{regex}}'

Print count of all possible strings that match a `regex`

exrex {{[-c|--count]}} '{{regex}}'

Context

tldr-pages: common/exrex

Revisions (0)

No revisions yet.