blog.up-link.ro android bsd linux unix & open-source world

3Jun/103

UNIX Tools: txt2regex – regular expression (regex) generator

WP Greet Box icon
Hello there! If you are new here, you might want to subscribe to the RSS feed or subscribe via E-mail for updates on this topic.

^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 txt2regex
Print This Post Print This Post
Comments (3) Trackbacks (0)
  1. Hello, I like your blog. This is a cool blog and I wanted to post a little note to let you know, good job! Thanks Tammy

  2. Hi guys, tried loading this blog through Google RSS reader and got a strange error message, any ideas what could be the issue?

  3. Nevermind, works now!


Leave a comment


*

No trackbacks yet.