Extended regular expressions were introduced in Section 8.4. Here, we just summarize the metacharacters that nvi provides. nvi also supports the POSIX bracket expressions, [[:alnum:]], and so on.
You use :set extended to enable extended regular expression matching.
When extended is set, text grouped with parentheses acts like text grouped in \(...\) in regular vi; the actual text matched can be retrieved in the replacement part of a substitute command with \1, \2, etc. In this case, \( represents a literal left parenthesis.
When extended is not set, nvi provides the same functionality with \{ and \}.
As might be expected, when extended is set, you should precede the above metacharacters with a backslash in order to match them literally.
Copyright © 2003 O'Reilly & Associates. All rights reserved.