User Guide

Using Regular Expressions 91
Special characters
Because special characters are the operators in regular expressions, in order to
represent a special character as an ordinary one, you need to precede it with a
backslash. To represent a backslash, for instance, use a double backslash (\\).
Single-character regular expressions
This section describes the rules for creating regular expressions. You can use regular
expressions in the Search > Extended Find and Replace command to match complex
string patterns.
The following rules govern one-character RegExp that match a single character:
Special characters are: + * ? . [ ] ^ $ ( ) { } | \ &
Any character that is not a special character matches itself.
Use the keyboard (Tab, Enter) to match whitespace characters.
The asterisk (*) matches the specified characters throughout the entire
document.
The carat (^) matches the beginning of the document.
The dollar sign ($) matches the end of the document.
A backslash (\) followed by any special character matches the literal character
itself, that is, the backslash escapes the special character.
The # and - characters must be escaped in expressions (## --) just as though they
were special characters.
A period (.) matches any character, including a new line. To match any character
except a new line, use
[^#chr(13)##chr(10)#], which excludes the ASCII
carriage return and line feed codes.
A set of characters enclosed in brackets ([]) is a one-character RE that matches
any of the characters in that set. For example,
[akm] matches an a, k, or m. Note
that if you want to include a closing square bracket (]) in square brackets, it must
be the first character. Otherwise, it does not work even if you use \].
Any regular expression can be followed by one of the following suffixes:
{m,n} forces a match of m through n (inclusive) occurrences of the preceding
regular expression
{m,} forces a match of at least m occurrences of the preceding regular
expression
The syntax {,n} is not allowed.
A range of characters can be indicated with a dash. For example,
[a-z] matches
any lowercase letter. However, if the first character of the set is the caret (^), the
RegExp matches any character except those in the set. It does not match the
empty string. For example,
[^akm] matches any character except a, k, or m. The
caret loses its special meaning if it is not the first character of the set.
All regular expressions can be made case-insensitive by substituting individual
characters with character sets, for example,
[Nn][Ii][Cc][Kk].