Previous: Char Classes, Up: Regular Expressions [Index]
For the most part, ‘\’ followed by any character matches only that character. However, there are several exceptions: certain sequences starting with ‘\’ that have special meanings. Here is a table of the special ‘\’ constructs.
an alternative
repeat the previous pattern exactly M times
specifies repetition
a grouping construct
the “shy group” (“non-capturing” or “unnumbered”) construct
the “explicitly numbered group” construct
matches the same text that matched DIGITth occurrence of a group
matches any word-constituent character
matches any character that is not a work constituent
matches any character whose syntax is CODE
matches any character whose syntax is not CODE
matches any character whose category is C. ‘M-x describe-categories’
matches any character whose category is not C
The following regular expression constructs match the empty string—that is, they don’t use up any characters—but whether they match depends on the context.
\`
matches the empty string, but only at the beginning of the buffer or string being matched against.
\'
matches the empty string, but only at the end of the buffer or string being matched against.
\=
matches the empty string, but only at point.
‘\b’
matches the empty string, but only at the beginning or end of a word.
‘\B’
matches the empty string, but not at the beginning or end of a word, nor at the beginning or end of the buffer (or string)
\<
matches the empty string, but only at the beginning of a word.
\>
matches the empty string, but only at the end of a word.
\_<
matches the empty string, but only at the beginning of a symbol.
\_>
matches the empty string, but only at the end of a symbol.
Previous: Char Classes, Up: Regular Expressions [Index]