Regular expression operators

The rules for using regular expression operators are:

When preceded by a vertical bar (|), the following characters have special meaning:

Character

Description

 (

Opens a group. Must be followed by a matching closing parenthesis ( ) ).

 )

Closes a group. Must be preceded by a matching opening parenthesis ( ( ).

 [

Opens a character class. Must be followed by a matching closing bracket (]).

 ]

Closes a character class. Must be preceded by a matching opening bracket ([).

 {

Opens a counted match. Must be followed by a matching closing brace (}).

 }

Closes a counted match. Must be preceded by a matching opening brace ({).

 ,

Separates OR clauses.

 *

Matches zero or more occurrences of the preceding expression.

 ?

Matches zero or one occurrence of the preceding expression.

 +

Matches one or more occurrences of the preceding expression.

All else

Matches itself.

Brackets

Between brackets ([ ]), the following characters have special meaning:

Character

Description

 ^

Must be the first character. Matches everything but following classes.

 ]

Closes the class. May only be preceded by a caret (^).

 -

Range operator. Preceded and followed by other characters.

All else

Matches itself, begins, or ends a range.

Braces

Between braces ({ }), the following meanings apply.

Character

Description

m

Matches exactly m occurrences of the preceding expression (0< m < 256).

m,

Matches at least m occurrences of the preceding expression (1< m < 256).

m,n

Matches between m and n occurrences of the preceding expression, inclusive (0 < m < 256, 0 < n < 256).

To match the asterisk (*), the period (.), and the question mark (?), enclose them in brackets. For example, to search for "hello?", type hello[?] in the query.