Expression | Syntax | Description | Example |
|---|
Minimal, zero or more | @ | Matches zero or more occurrences of the preceding expression, and matches as few characters as possible. | e.@ matches "ente" and "erprise" in "enterprise", but not the full word "enterprise". |
Minimal, one or more | # | Matches one or more occurrences of the preceding expression, and matches as few characters as possible. | ac# matches words that contain the letter "a" and at least one instance of "c", such as "ace". a.#s matches "acces" in the word "access". |
Repeat n times | ^n | Matches n occurrences of the preceding expression. | [0-9]^4 matches any 4-digit sequence. |
Grouping | () | Lets you group a set of expressions together. If you want to search for two different expressions in a single search, you can use the Grouping expression to combine them. | If you want to search for - [a-z][1-3] or - [0-9][a-z], you would combine them: (- [a-z][1-3])|(- [0-9][a-z]). |
nth tagged text | \n | In a Find or Replace expression, indicates the text that is matched by the nth tagged expression, where n is a number from 1 to 9. In a Replace expression, \0 inserts the complete matched text. | If you search for a{[0-9]} and replace with \1, all occurrences of "a" followed by a digit are replaced by the digit it follows. For example, "a1" is replaced by "1" and similarly "a2" is replaced by "2". |
Right-justified field | \(w,n) | In a Replace expression, right-justifies the nth tagged expression in a field at least w characters wide. | If you search for a{[0-9]} and replace with \(10,1), the occurrences of "an" are replaced by the integer and right-justified by 10 spaces. |
Left-justified field | \(-w,n) | In a Replace expression, left-justifies the nth tagged expression in a field at least w characters wide. | If you search for a{[0-9]} and replace with \(-10,1), the occurrences of "an" are replaced by the integer and left-justified by 10 spaces. |
Prevent match | ~(X) | Prevents a match when X appears at this point in the expression. | real~(ity) matches the "real" in "realty" and "really," but not the "real" in "reality." |
Alphanumeric character | :a | Matches the expression ([a-zA-Z0-9]). | Matches any alphanumeric character, such as "a", "A", "w", "W", "5", and so on. |
Alphabetic character | :c | Matches the expression ([a-zA-Z]). | Matches any alphabetical character, such as "a", "A", "w", "W", and so on. |
Decimal digit | :d | Matches the expression ([0-9]). | Matches any digit, such as "4" and "6". |
Hexadecimal digit | :h | Matches the expression ([0-9a-fA-F]+). | Matches any hexadecimal number, such as "1A", "ef", and "007". |
Rational number | :n | Matches the expression (([0-9]+.[0-9]*)|([0-9]*.[0-9]+)|([0-9]+)). | Matches any rational number, such as "2007", "1.0", and ".9". |
Alphabetic string | :w | Matches the expression ([a-zA-Z]+). | Matches any string that contains only alphabetical characters. |
Escape | \e | Unicode U+001B. | Matches the "Escape" control character. |
Bell | \g | Unicode U+0007. | Matches the "Bell" control character. |
Backspace | \h | Unicode U+0008. | Matches the "Backspace" control character. |
Tab | \t | Unicode U+0009. | Matches a tab character. |
Unicode character | \x#### or \u#### | Matches a character given by Unicode value where #### is hexadecimal digits. You can specify a character that is outside the Basic Multilingual Plane (that is, a surrogate) with the ISO 10646 code point or with two Unicode code points that give the values of the surrogate pair. | \u0065 matches the character "e". |