Help Start | Home | Finders Keepers

Regular Expressions

A regular expression is a formula for looking for text. You make regular expressions with characters. Some characters have special meanings. Other characters are just plain letters and numerals you are looking for. The characters that have special meaning, or effect, are called symbols or operators.

A regular expression can be just one character or it can be one or more characters enclosed in brackets. Regular expressions may be joined to make a regular expression. A regular expression that is a part of a larger regular expression may be called a sub-expression.

Regular Expression Symbols

Symbol

Description
^ Put a circumflex at the start of an expression to match the beginning of a line.

$ Put a dollar sign at the end of an expression to match the end of a line.

. Put a period anywhere in an expression to match any character.

* Put an asterisk after an expression to match zero or more occurrences of that expression.

+ Put a plus sign after an expression to match one or more occurrences of that expression.

? Put a question mark after an expression to match zero occurrences or one.

[ ] Put characters inside square brackets to match any one of the bracketed characters but no others.

[^] Put a leading circumflex inside square brackets with one or more characters to match any character except those inside the brackets.

[ - ] Put a hyphen inside square brackets between characters to designate a range of characters.

< Put a left angle bracket at the start of an expression to match the beginning of a word.

> Put a right angle bracket at the end of an expression to match the end of a word.

\b Use backslash b to match the backspace character (# 8).

\t Use backslash t to match the tab character (# 9).

\n Use backslash n to match the new-line character (# 10).

\f Use backslash f to match the form-feed character (# 12).

\r Use backslash r to match the carriage-return character (# 13).

\x00 Use backslash x with a hexadecimal code of \x00 to \xFF to match the corresponding character.

\ Use a backslash to make a regular-expression symbol a literal character.

| Use a vertical bar between expressions to match either expression. Use up to nine vertical bars, separating up to ten expressions, any of which are to be found in a line. NOTE: Spaces before and after the vertical bar are significant. For example, “near | far” represents a regular-expression search for “near “ or “ far”, not “near” or “far”.

& Use an ampersand between expressions to match both expressions. Use up to nine ampersands, joining up to ten expressions, all of which are to be found in a line. NOTE: Spaces before and after the ampersand are significant. Thus, “near & far” is not the same as “near&far”, which is probably what you want.

{ } Use a left curly bracket paired with a right curly bracket to denote a sub-expression within the complete regular expression. You may make and denote multiple sub-expressions within the complete regular expression. You may refer to such sub-expressions by number if you create Replacement Expressions for Replace operations. This denotation of a sub-expression has no effect on Find operations.


See: Regular Expression Examples