Regular Expressions

Regular expressions are a way to specify text patterns when searching for a text in a buffer. Regular expressions consist of normal characters and special operator characters with a special meanings. Operators allow you to anchor matches, match classes of characters, match given pattern several times or match alternate patterns. Operators can be also used to group patterns.

# Search/Match Operators

\
  Quotes the following character. If the following character is not alphanumeric, it will lost it's special meaning, otherwise it will gain a special meaning as described below.
\n
  Matches a 0x0A (LF) character.
\r
  Matches a 0x0D (CR) character.
\t
  Matches a 0x09 (TAB) character.
\e
  Matches an escape character (0x1B)
\s
  Matches whitespace (CR, LF, TAB, SPACE) characters.
\S
  Matches non-whitespace (the reverse of \s)
\w
  Matches word character [a-zA-Z0-9]
\W
  Matches non-word character
\d
  Matches a digit [0-9].
\D
  Matches a non-digit.
\U
  Matches uppercase characters (A-Z)
\L
  Matches lowercase characters (a-z)
\x##
  Matches specified hex value (\x0A, \x0D, \x09, etc.)
\o###
  Matches specified octal value (\o000, \o015, etc.)
\N###
  Matches specified decimal value (\N000, \N013, \N009, etc.)
\C
  Starts case sensitive matching.
\c
  Starts case insensitive matching.
^
  Match a beginning of line.
$
  Match an end of line.
.
  Match any character.
<
  Match beginning of word (word consists of [A-Za-z0-9]).
>
  Match end of word.
[ ]
  Specifies a class of characters ([abc123], [\]\x10], etc).
[ - ]
  Specified a range of characters ([0-9a-zA-Z_], [0-9], etc)
[^ ]
  Specifies complement class ([^a-z], [^\-], etc)
?
  Matches preceeding pattern optionally (a?bc, filename\.?, $?, etc)
|
  Matches preceeding or next pattern (a|b, c|d, abc|d). Only one character will be used as pattern unless grouped together using {} or ().
*
  Match zero or more occurances of preceeding pattern. Matching is greedy and will match as much as possible.
+
  Match one or more occurances of preceeding pattern. Match is greedy.
@
  Match zero or more occurances of preceeding pattern. Matching is non-greedy and will match as little as possible without causing the rest of the pattern match to fail.
#
  Match one or more occurances of preceeding pattern. Matching is non-greedy.
{ }
  Group patterns together to form complex pattern. ( {abc}, {abc}|{cde}, {abc}?, {word}?)
( )
  Group patterns together to form complex pattern. Also used to save the matched substring into the register which can be used for substitution operation. Up to 9 registers can be used.

# Replacement Operators

\
  Causes the next character to lose it's special meaning.
\n
  Inserts a 0x0A (LF) character.
\r
  Inserts a 0x0D (CR) character.
\t
  Inserts a 0x09 (TAB) character.
\1 to \9
  Recalls stored substrings from registers (\1, \2, \3, to \9).
\0
  Recalls entire matched pattern.
\u
  Convert next character to uppercase
\l
  Convert next character to lowercase
\U
  Convert to uppercase till \E or \e
\L
  Convert to lowercase till \E or \e