Some regular expression metacharacters are valid for one program but not for another. Those that are available to a particular UNIX program are marked by a bullet () in Table 26.4. Quick reference descriptions of each of the characters can be found in article 26.10.
[Unfortunately, even this table doesn't give the whole story.
For example, Sun has taken some of the extensions
originally developed for ed, ex, and vi
(such as the
\< \> and
modifiers) and added them to other programs that use regular expressions.
So don't be bashful - try things out, but just don't be surprised if
every possible regular expression feature isn't supported by every
In addition, there are many programs that recognize
regular expressions, such as perl, emacs, more, dbx,
expr, lex, pg, and less,
that aren't covered in Daniel's table. -TOR ]
|.||Match any character.|
Match zero or more preceding.
|^||Match beginning of line.|
|$||Match end of line.|
Escape character following.
|[ ]||Match one from a set.|
Store pattern for later replay.
Match a range of instances.
Match word's beginning or end.
Match one or more preceding.
Match zero or one preceding.
Separate choices to match.
Group expressions to match.
In ed, ex, and sed, note that you specify both a search pattern (on the left) and a replacement pattern (on the right). The metacharacters in Table 26.4 are meaningful only in a search pattern. ed, ex, and sed support the additional metacharacters in Table 26.5 that are valid only in a replacement pattern.
|\||Escape character following.|
|\||Reuse pattern stored in |
|&||Reuse previous search pattern.|
|~||Reuse previous replacement pattern.|
|\u \U||Change character(s) to uppercase.|
|\l \L||Change character(s) to lowercase.|
|\E||Turn off previous |
|\e||Turn off previous |