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

Metacharacters in regular expressions

Any character that has a special meaning to the shell is a ``metacharacter''. For example, some punctuation marks, such as the period (.) and question mark (?), have a special meaning in some contexts that will cause the shell to try interpreting them rather than just reading them. One set of metacharacters is used to group commands. See, for example, ``Entering commands on the same line'' and ``Running commands in a pipeline''.

In addition, there are two families of regular expression metacharacters, the ``Wildcard characters'' used for matching filenames, and the more complex ``Editor regular expressions'' metacharacters, which are used to match text strings within files. The asterisk is a wildcard character denoting any string consisting of zero or more characters.

As we saw in ``Automating frequent tasks'', these simple patterns are expanded by the shell, not by the program ls used in this example. All the shells recognize the same family of wildcard characters.

The second family of regular expressions is much more complex, and is used by such programs as ed(C), sed(C), awk(C), vi(C), grep(C), and egrep(C). The editor regular expressions are used to search for text in files, rather than to search for files in directories. They are explained in ``Editor regular expressions''.


Next topic: Wildcard characters
Previous topic: Literal characters in regular expressions

© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 03 June 2005