: Learning GNU Emacs, 3rd Edition Regular expression operator summary Regular expression operator summary

Table 11-6 concludes our discussion of regular expression operators with a reference list of all the operators covered.

Table11-6.Regular expression operators

Operator Function
. Match any character.
* Match 0 or more occurrences of preceding char or group.
+ Match 1 or more occurrences of preceding char or group.
? Match 0 or 1 occurrences of preceding char or group.
[...] Set of characters; see below.
( Begin a group.
) End a group.
| Match the subexpression before or after |.
^ At beginning of regexp, match beginning of line or string.
$ At end of regexp, match end of line or string.
n Match Newline within a regexp.
t Match Tab within a regexp.
< Match beginning of word.
> Match end of word.
The following operators are meaningful within character sets:
^ At beginning of set, treat set as chars not to match.
- (dash) Specify range of characters.
The following is also meaningful in regexp replace strings:
n Substitute portion of match within the nth ( and ), counting from left ( to right, starting with 1.

Finally, the following characters are operators (not discussed here) when double-backslash-escaped: b, B, c, C, w, W, s, S, =, _, ', and `. Thus, these are "booby traps" when double-backslash-escaped. Some of these behave similarly to the character class aliases you may have encountered in Perl and Java regular expressions.

: 0.277. /Cache: 3 / 1