Contents of the REGEXP.TXT file
The Use of UNIX Regular Expressions
Regular Expressions are a standard function of the UNIX operating system.
They are used to search for or replace text located within files or from the
keyboard. The UNIX commands GREP (Global Regular Expression Print) and
SUBS (SUBstitue Strings) are used to manipulate text via regular expressions.
There are various characters that the reuglar expression processor sees as
having special meaning. These special characters are:
. period matches any alpha-numeric character
^ caret matches the beginning of the line
will find all line beginning with #include
$ dollar matches the end of the line
will find all lines ending with a close brace
* asterisk Repeats any number of the last pattern. Includes
finds lines with at least one occurence of test.
 brakets specifies a set of given characters.
will find lines begining with any one of the
- hyphen denotes a range of characters.
finds lines ending in a capital letter or a number.
\ backslash removes the special characteristics of a character.
finds dollar signs in a line of text.
will locate all .C files that begin with the letters
A through D. Notice the escaping of the '.' before
the C extent.
, comma separates multiple reglar expressions
will locate all files that begin with the letters
A through D and All files that end in EXE.
NOTE: When the caret (^) is used as the first character after a left
square braket, it reverses the meaning of the search.
will find all lines not ending with a capital letter.
will find all lines not begining with a capital letter. Note that
in this case the caret is used in both contexts.
At times is is useful to denote a segment of the search string. In
ZGrep is a powerful tool to find any combination of file names.
\( denotes the beginning of a segment.
\) denotes the end of a segment.
The best way to understand this usage is by example.
To find all files that begin with the letters A-M
In this command the use of the '.*' within the first segment is a powerful
construction. It is the same as the DOS '*' wild card. The period followed by
the asterisk means repeat any character any number of times. The files of the
file is the first part of the search.