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: 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 n n n n y y y
egrep y y y y n y y y y y y y
awk y y y n n y y y y y y y
Tcl y y y y n y y y y y y y
ed y y y y y n n n n y y y
vi y y y y n n n n n y y y
sed y y y y y n n n n 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, ``Programming with awk'' and ``Manipulating text with sed''.


© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 22 April 2004