UNIX Tools: txt2regex – regular expression (regex) generator
^txt2regex$ is a regular expression wizard that leads the user through the construction of a regular expression. txt2regex can create RegExes for use with different programs, including awk, ed, egrep, Emacs, expect, find, grep, lex, Lisp, MySQL, OpenOffice.org, Perl, PHP, PostgreSQL, Procmail, Python, Sed, Tcl, VBscript and vi. It is a useful tool for users with little or no knowledge of regular expressions and is included in several Linux distributions ( including Debian, Gentoo, Ubuntu ), in FreeBSD, and in Fink for Mac OS X.
Anyone who has worked with regular expressions knows what a godsend then can be if you get the regex down pat – but they would also know what a time sink they can be if you can't whip up exactly what you want. txt2regex is a tool that eliminates the confusion.
To install txt2regex on Debian / Ubuntu, enter:
sudo apt-get install txt2regex
To install txt2regex on FreeBSD, enter:
cd /usr/ports/misc/txt2regex make install clean
After installation you can simply run the program directly
txt2regex
and follow the wizard.
Among its features include the ability to print a list of characteristics of the regular expression syntax for various tools, a history tool which keeps track of you past regexes, and some pre-built regexes that are often used.
For more info read the manual
man txt2regexPrint This Post