Regular Expression Matching

Constructing a regular expression to match particular strings can be
a long and painful task. This regex tool aims to help the
development of the proper regular expressions by providing a quick way
to test your regular expression against an arbitrary string. The
regex tool uses POSIX regular expressions, not Perl
regular expressions. Details on using regex are found
below.

The source for the regex tool is contained within the
regex.c; instructions for building the tool can be found
here.

The regex tool can be used while reading the introduction to
try out the regular expression features it describes.

Some of the information displayed may not be helpful for you; the
regex tool was written to aid in the development of the
mod_rewrite module for proftpd, hence why it
delves deeper into the specifics of regular expression matching than the
average system administrator may need.

Running regex without any parameters, or with the wrong number
of parameters, reminds you of that it needs parameters for doing its job:

The "compiled pattern" line reports on the pattern that is being
compiled as the regular expression; this is how you can tell whether the
shell is transforming your pattern into something different before
passing it to the regex tool.

In many of these examples, you see "(1 expression)" or
"(2 expressions)" displayed; what are these?

This shows that the first substring (starting at zero) is 39065,
that the substring starts at offset 0, and ends at offset
5.

These examples are from a case where a user needs a particular
proftpdFilter expression for some filesystem
paths; the strength of regex lies in the ability to test out
such filters without running the program itself: