Character

Meaning

Examples

_

-

[ ]

If it is at the beginning or the end of a

 

regular expression, it equals ^ or $.

"a_b" matches "a b" or "a(b"; "_ab" only matches

In other cases, it equals comma,

a line starting with "ab"; "ab_" only matches a line

space, round bracket, or curly

ending with "ab".

bracket.

 

It connects two values (the smaller

 

one before it and the bigger one

"1-9" means 1 to 9 (inclusive); "a-h" means a to h

after it) to indicate a range together

(inclusive).

with [ ].

 

[16A] matches a string containing any character among 1, 6, and A; [1-36A] matches a string

containing any character among 1, 2, 3, 6, and A

Matches a single character (- is a hyphen). contained within the brackets.

To match the character "]", put it at the beginning of

astring within brackets, for example [ ]string]. There is no such limit on "[".

 

A character group. It is usually used

(123A) means a character group "123A";

( )

"408(12)+" matches 40812 or 408121212. But it

with "+" or "*".

 

does not match 408.

 

 

 

 

 

 

Repeats the character string

 

 

specified by the index. A character

(string)\1 repeats string, and a matching string must

 

string refers to the string within ()

 

before \. index refers to the

contain stringstring. (string1)(string2)\2 repeats

 

sequence number (starting from 1

string2, and a matching string must contain

\index

from left to right) of the character

string1string2string2. (string1)(string2)\1\2

 

group before \. If only one character

repeats string1 and string2 respectively, and a

 

group appears before \, index can

matching string must contain

 

only be 1; if n character groups

string1string2string1string2.

 

appear before index, index can be

 

 

any integer from 1 to n.

 

 

 

 

 

 

[^16A] means to match a string containing any

 

Matches a single character not

character except 1, 6 or A, and the matching string

[^]

can also contain 1, 6 or A, but cannot contain these

contained within the brackets.

 

three characters only. For example, [^16A]

 

 

 

 

matches "abc" and "m16", but not 1, 16, or 16A.

 

 

 

\<string

Matches a character string starting

"\<do" matches word "domain" and string "doa".

with string.

 

 

 

 

 

string\>

Matches a character string ending

"do\>" matches word "undo" and string "abcdo".

with string.

 

 

 

 

 

 

Matches character1character2.

"\ba" matches "-a" with "-" being character1, and

 

character1 can be any character

\bcharacter2

"a" being character2, but it does not match "2a" or

except number, letter or underline,

 

"ba".

 

and \b equals [^A-Za-z0-9_].

 

 

 

 

 

 

Matches a string containing

"\Bt" matches "t" in "install", but not "t" in "big

\Bcharacter

character, and no space is allowed

top".

 

before character.

 

 

 

 

 

131