Skip to main content

Shorthand expressions

The following expressions are shorthand for longer or more complex regular expressions:

Expression

Purpose

Example

Match

[:alpha:]

Matches must consist of letters.

[:alpha:]8,16

aBcmGLeEhhi

[:digit:]

Matches must consist of digits. [:digit:] is equivalent to [:d:] and \ d.

[[:digit:]]+

2962954576

[:upper:]

Matches must consist of uppercase characters.

[[:upper:][:digit:]]+

9DDD4MLAG13

[:alnum:]

Matches must be alphanumeric. [:alnum:] is short hand for [a-zA-Z0-9] in the ascii character set, but the use of [:alnum:] is preferred for compatibility with other languages and character sets.

[:alnum:]7[^[:digit:]]

a3dM9DD+