TXT2REGEX(1)
πΈ TXT2REGEX β the console regular expression wizard β¨
okay bestie, sit down, we're learning txt2regex, which lives in the General Commands Manual section (that's section 1, iykyk) and is genuinely one of the most underrated glow-ups in Unix history π
β¨ NAME β¨
txt2regex β console regular expression wizard π§
π SYNOPSIS π
txt2regex [--nocolor|--whitebg] [--all|--prog programs]
txt2regex --showmeta
txt2regex --showinfo program [--nocolor]
txt2regex --history value [--all|--prog programs]
txt2regex --make label [--all|--prog programs]
likeβ¦ five whole moods. pick your fighter π
π¦ DESCRIPTION π¦
So txt2regex is a regular expression wizard that converts human sentences into regexes. that's the whole vibe. you type the thing you mean in people-words, it hands you back the regex. no cap π₯
In a simple interactive console interface, the user answers questions and txt2regex builds the regexes for more than 20 programs. twenty. plus. programs. one wizard. iconic behavior honestly π
the project lives at https://aurelio.net/projects/txt2regex/ β go say hi, it's giving main character energy π
π OPTIONS π
--allβ selects all the available programs. β οΈ but bestie, be aware that the list of available programs is long. you will need a terminal window with more than 40 lines for the user interface to fit. also make sure that the$LINESshell variable is exported, sotxt2regexcan detect the current number of available lines. do not skip that step, fr fr π-h,--helpβ print the help message and quit. the classic. the beloved. π«Ά--history <value>β print a regex from the given history data. the history value is shown in the last screen of the wizard, when you quit. so don't close the terminal like a gremlin, screenshot it first πΈ--make <label>β print a ready regex for the specified label. inform an empty label to see the list of available labels. yes, empty. like, nothing. that's the cheat code π--nocolorβ do not use colors. (respect. some terminals are just going through it) π«π--prog <program1,program2,...>β specify which programs to use, separated by commas. use--showmetato see the complete list of available programs. pick your squad π--showinfo <program>β print regex-related info about the specified program. use--nocolorto have a text-only output (no control characters). clean, plain, β¨unbotheredβ¨--showmetaβ print a metacharacters table featuring all the programs. this is the big one. the group photo. π-V,--versionβ print the program version and quit. short and sweet, love that for it β--whitebgβ adjust colors for white background terminals. because your eyes deserve nice things π¦
π EXAMPLES π
Using it as a wizard (interactive interface):
txt2regex
Specify a custom selection of programs for the wizard:
txt2regex --prog perl,python,php,javascript
Getting an extensive metacharacters table:
txt2regex --showmeta
Getting regex-related information about sed:
txt2regex --showinfo sed
Replay a regex by using history data:
txt2regex --history '16421Β€:01Β€:'
Getting handy ready-to-use regexes for common patterns:
txt2regex --make hour
txt2regex --make number3 --prog perl
txt2regex --make date2 --all
look at that last one going --all like a boss π slay.
π WIZARD INTERFACE π
here's the layout of the whole thing, bestie. this is your screen:
+---------------------------------------+
| Top menu |
| Group menu |
| |
| Regexes of the selected programs |
| ... |
| ... |
| |
| History |
| Prompt |
| |
| The question |
| The answers |
| ... |
| ... |
+---------------------------------------+
Top menu, group menu, the regexes of the selected programs, history, prompt, the question, the answersβ¦ it's a whole little world in there πΈ
π WIZARD COMMANDS π
these are the keys you press while you're inside the wizard. memorize them, they're your love language:
.β quit the program (with confirmation). it asks first because it's polite π₯Ί0β reset the regular expression. fresh start, clean slate, new me π§Ό1-9β answers the questions. nine whole answers at your fingertips π’*β toggles color ON/OFF π/β add/remove programs ββ|β insert an alternation (where allowed) π(β open a new group (where allowed) π)β close the opened group (if any) π
ok real talk:|,(and)say "where allowed" for a reason β you can't just spam them anywhere, the wizard will tell you. and)only does something if there's a group open, so don't be out here closing nothing π
π BUGS π
found a bug? not me being dramatic butβ¦ https://github.com/aureliojargas/txt2regex/issues β that's the place. report it there, bestie, the maintainers wanna know π
π«Ά AUTHOR π«Ά
Aurelio Jargas <verde@aurelio.net> β the legend themselves π
β COPYRIGHT β
Copyright Β© 2001-2020 Aurelio Jargas, GNU GPL v2 π
and that's the whole page!! this one's from the General Commands Manual gang (TXT2REGEX(1)), dated May 21, 2020, and that's a wrap β go build some regexes, you absolute icon πβ¨
π¦ where this page comes from
- debian bookworm: txt2regex 0.9-5
- debian trixie: txt2regex 0.9-5
- epel 10: txt2regex 0.9-12.el10_0 Β· GPL-2.0-only
- epel 9: txt2regex 0.9-5.el9 Β· GPLv2
- fedora 43: txt2regex 0.9-15.fc43 Β· GPL-2.0-only
- fedora 44: txt2regex 0.9-16.fc44 Β· GPL-2.0-only
- ubuntu jammy: txt2regex 0.9-4
- ubuntu noble: txt2regex 0.9-5
- ubuntu questing: txt2regex 0.9-5
- ubuntu resolute: txt2regex 0.9-5build1
- ubuntu stonking: txt2regex 0.9-5build1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms