Rexpy

The rexpy command

rexpy [FLAGS] [inputfile [outputfile]]

If inputfile is provided, it should contain one string per line; otherwise lines will be read from standard input.

If outputfile is provided, regular expressions found will be written to that (one per line); otherwise they will be printed.

Optional FLAGS may be used to modify Rexpy’s behaviour:

-h, --header
Discard first line, as a header.
-?, --help
Print this usage information and exit (without error)
-g, --group

Generate capture groups for each variable fragment of each regular expression generated, i.e. surround variable components with parentheses, e.g.

^[A-Z]+\-[0-9]+$

becomes

^([A-Z]+)\-([0-9]+)$
-q, --quote

Display the resulting regular expressions as double-quoted, escaped strings, in a form broadly suitable for use in Unix shells, JSON, and string literals in many programming languages. e.g.

^[A-Z]+\-[0-9]+$

becomes

"^[A-Z]+\\-[0-9]+$"
--portable
Product maximally portable regular expressions (e.g. [0-9] rather than \d). (This is the default.)
--grep
Same as --portable
--java
Produce Java-style regular expressions (e.g. \p{Digit})
--posix
Produce POSIX-compilant regular expressions (e.g. [[:digit:]] rather than \d).
--perl
Produce Perl-style regular expressions (e.g. \d)
-u , --underscore, -_
Allow underscore to be treated as a letter. Mostly useful for matching identifiers.
-d, --dot, -., --period
Allow dot to be treated as a letter. Mostly useful for matching identifiers.
-m, --minus, --hyphen, --dash
Allow minus to be treated as a letter. Mostly useful for matching identifiers.
-v, --version
Print the version number.
-V, --verbose
Set verbosity level to 1
-VV, --Verbose
Set verbosity level to 2
-vlf, --variable
Use variable length fragments
-flf, --fixed
Use fixed length fragments

Rexpy Examples

TDDA rexpy is supplied with a set of examples.

To copy the rexpy examples, run the command:

tdda examples rexpy [directory]

If directory is not supplied, rexpy_examples will be used.

Alternatively, you can copy all examples using the following command:

tdda examples

which will create a number of separate subdirectories.