REGULAR EXPRESSIONS

8/25/2001

Regular Expressions: A method of specifying character strings other than simple keyboard text. Regular expressions are founded on the work of mathematician Stephen Cole Kleene and were incorporated into various aspects of Unix when Unix was created at Bell Telephone Labs. REs are widely used in Unix and its descendants as well as scripting languages e.g. PERL, Java Script, REXX, VBSCRIPT. There are said to be some subtle implementation differences between implementations. Some, including VBSCRIPT, may not be complete implementations.

Regular expressions assign special meanings to a few standard characters including \.?([^+-*{. These characters are then used to define characters that can not be typed or to define search conditions. For example \c7 is RE shorthand the ASCII character 7 (Bell) and . is shorthand for match any single character.

Since it is sometimes necessary to use the metacharacters normally as in "3.14". This is done by use of \. 3.14 specifies any string of the form "3x14" where x is any character. 3\.14 specifies exactly the string "3.14". \\ is the character \. Likewise. \followed by a character often gives the character special meaning. d is just the character d. \d is any single digit. \D is any single non-digit.

Regular expressions are very flexible, but they are also quite confusing. Most normal people confine their use to scripts as creating properly formed REs on the fly is difficult.

RE metacharacters.

Return To Index Copyright 1994-2002 by Donald Kenney.