DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Regular expressions

Regular expression summary

Not all of the editor regular expression constructions are recognized by all of the editor programs. The following table categorizes the most common metacharacters and the programs that use them.

Note also that the table covers only the editor regular expression constructions. The wildcard metacharacters are not entirely compatible with the editor regular expression set described below. It is therefore important to be clear about which program will interpret a regular expression. Programs like awk and grep require you to enclose a regular expression on the command line, intended as an argument, in quotes. If you do not, the shell will try to interpret it as a wildcard regular expression, passing on any results to the program. This can have unexpected results.

Note that awk and Tcl in particular provide powerful programming constructs that can be used to manipulate text, but which fall outside the scope of regular expressions as such.

In the following table, a ``y'' indicates that the command supports the notation.

Regular expressions syntax recognized by programs

Command Regular expression supported?
. * [...] \(...\) \{...\} ? + | () ^ $ \
grep y y y y y y y y
egrep y y y y y y y y y y y
awk y y y y y y y y y y
Tcl y y y y y y y y y y y
ed y y y y y y y y
vi y y y y y y y
sed y y y y y y y y
Note that due to subtle differences in the way the metacharacters are used by the editor programs, it is advisable to check the documentation that accompanies those programs. See, for example, ``Using awk'' and ``Manipulating text with sed''.


Next topic: Korn shell regular expressions
Previous topic: Precedence in regular expressions

© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003