The following special matching characters are defined. They can be used in both the search string and replacement string of a regular expression.
- \b
- Matches the ASCII backspace character (hex 08).
- \dDDD
- Matches the character with decimal value ‘DDD’. All three digits MUST be present. “\d010” does not work in the search string; use “\N” instead.
- \e
- Matches the ASCII <Esc> character (hex 1B).
- \f
- Matches the ASCII Form-feed character (hex 0C).
- \hHH
- Matches the character with hexadecimal value ‘HH’. Both digits MUST be present. “\h0A” does not work in the search string; use “\N” instead.
- \n
- Matches the Line-Feed character (hex 0A). This is the “newline” character for UNIX type text files. To search for multiple-line patterns, use “\N” instead.
- \N
- Matches the “newline” character(s) and allows searching for multiple line patterns. The “newline” depends upon the current file type and can be <CR><LF>, <LF> or <CR>. (Currently, “\N+” and “\N*” are not supported.)
- \oOOO
- Matches the character with octal value ‘OOO’. All three digits MUST be present. “\o012” does not work in the search string; use “\N” instead.
- \r
- Matches the ASCII Carriage-Return character (hex 0D).
- \s
- Matches the ASCII space character (hex 20).
- \t
- Matches the ASCII Tab character (hex 09)
- \0
- Matches the ASCII Null character (hex 00)
- \@(r)
- Use the contents of text register ‘r’ in this position in the search (or replace) string.
The OR Operator
The special character “|” is the “OR” operator which may occur between two sub-expressions. The entire expression then matches any text that is matched by the preceding sub-expression OR the following sub-expression. Note: “|”cannot occur within “{ }”; each sub-expression must by itself be a valid expression.
“|” is the “pipe” character, which is Shift-\ on the keyboard.
- man|woman
- Matches the word "man" OR the word "woman"
- a+|b+
- Matches one or more occurrences of "a" OR of "b"
Related Resources