Table 1. RegEx Metacharacters
Character Group Type Meaning Example

a

-

Any non-metacharacter stands for itself

.

B

See *

*

B

Quantifier

Zero or more

b.*ful

^

B

Begin of line

^root

$

B

End of line

ksh$

\

B

Modifier

Disable following char; enable brackets in ERE

Mr\.

[ ]

B

CCL

One and only one char from set

[abc]

[^ ]

B

CCL

One and only one char NOT from set

[^abc]

\{min,max\}

B

Quantifier

min thru max

zsa\{1,2} gabor

\<

B

start Word Boundary

\<ther

\>

B

End word boundary

For finding full word w/ grep, use -w

?

E

Quantifier

0 or 1 only (optional)

(Bond\. )?James Bond.

+

E

Quantifier

1 or more (usually better than *)

\d+

( )

E

Grouping

hypnot(ists|izes)

\( \)

E

Tagging (sed, ERE)

Mark part of RE for re-use

sed 's/\([A-Z][A-Z]).*/\1/'

|

E

Alternation (or)

see ( ) Grouping example

\s

P

CCL

Space char

grep '^\s+' # find leading space

\S

P

CCL

Non-Space char

\d

P

CCL

Digit

\D

P

CCL

Non-Digit

\w

P

CCL

Word char

\W

P

CCL

Non-word-char

\p{Alpha}

X

CCL

Any alphabetic character

\p{Alnum}

X

CCL

Any alphabnumeric character

\p{Lower}

X

CCL

Any alphabnumeric character

Notes: Group B is basic, E is extended, P is Perl/Postmodern, X is POSIX. CCL means character class.

I’ve only given a few of the POSIX ones because they are cumbersome to type.

Modern languages accept pretty much all of these, and some like Java accept many more; search javadoc java.util.regex.Pattern.