Share via


Regular Expressions

Home Page (Text Editor)OverviewHow Do I ... TopicsFAQReference

Regular Expression Description
. (Period.) Any single character.
[ ] Any one of the characters contained in the brackets, or any of an ASCII range of characters separated by a hyphen (-). For example, b[aeiou]d matches bad, bed, bid, bod, and bud, and r[eo]+d matches red, rod, reed, and rood, but not reod or roed. x[0-9] matches x0, x1, x2, and so on. If the first character in the brackets is a caret (^), then the regular expression matches any characters except those in the brackets.
^ The beginning of a line.
$ The end of a line.
\( \) Indicates a tagged expression to retain for replacement purposes. If the expression in the Find What text box is \(lpsz\)BigPointer, and the expression in the Replace With box is \1NewPointer, all selected occurrences of lpszBigPointer are replaced with lpszNewPointer. Each occurrence of a tagged expression is numbered according to its order in the Find What text box, and its replacement expression is \n, where 1 corresponds to the first tagged expression, 2 to the second, and so on. You can have up to nine tagged expressions.
\~ No match if the following character or characters occur. For example, b\~a+d matches bbd, bcd, bdd, and so on, but not bad.

You can use this expression to prefix a group of characters you want to exclude, which is useful for excluding matches of particular words. For example, foo\~\(lish\) matches "foo" in "food" and "afoot" but not in "foolish."

\{c\!c\} Any one of the characters separated by the alternation symbol (\!). For example, \{j\!u\}+fruit finds jfruit, jjfruit, ufruit, ujfruit, uufruit, and so on.
* None or more of the preceding characters or expressions. For example, ba*c matches bc, bac, baac, baaac, and so on.
+ At least one or more of the preceding characters or expressions. For example, ba+c matches bac, baac, baaac, but not bc.
\{\} Any sequence of characters between the escaped braces. For example, \{ju\}+fruit finds jufruit, jujufruit, jujujufruit, and so on. Note that it will not find jfruit, ufruit, or ujfruit, because the sequence ju is not in any of those strings.
[^] Any character except those following the caret (^) character in the brackets, or any of an ASCII range of characters separated by a hyphen (-). For example, x[^0-9] matches xa, xb, xc, and so on, but not x0, x1, x2, and so on.
\:a Any single alphanumeric character [a – zA – Z0 – 9].
\:b Any white-space character. The \:b finds tabs and spaces. There is no alternate syntax to express :b.
\:c Any single alphabetic character [a – zA – Z].
\:d Any decimal digit [0 – 9].
\:n Any unsigned number \{[0-9]+\.[0-9]*\![0-9]*\.[0-9]+\![0-9]+\}. For example, \:n should match 123, .45, and 123.45.
\:z Any unsigned decimal integer [0 – 9]+.
\:h Any hexadecimal number [0 – 9a – fA – F]+.
\:i Any C/C++ identifier [a – zA – Z_$][a – zA – Z0 – 9_$]+.
\:w Any alphabetic string [a – zA – Z]+. The string need not be bounded by white space or appear at the beginning or the end of a line.
\:q Any quoted string \{"[^"]*"\!'[^']*'\}.
\ Removes the pattern match characteristic in the Find What text box from the special characters listed above. For example, 100$ matches 100 at the end of a line, but 100\$ matches the character string 100$ anywhere on a line.