Name

[: :] (Character Class) — Specifies a character class

Synopsis

Use [: and :] to enclose a character class name, for example: [:alpha:]. Character classes must be specified within bracket expressions, as in [[:alpha:]].

The following example uses the character class [:digit:] to match the digits in a ZIP code:

SELECT REGEXP_SUBSTR(
   'Munising MI 49862',
   '[[:digit:]]{5}') zip_code
FROM dual;

49862

In this example, we could just as well have used the pattern [0-9]{5}. However, in multilingual environments digits are not always the characters 0-9. The character class [:digit:] matches the English 0-9, the Arabic-Indic ٠٩, the Tibetan , and so forth.

Table 1-5 describes the character class names recognized by Oracle. All names are case-sensitive.

Table 1-5. Supported character classes

Class

Description

[:alnum:]

Alphanumeric characters (same as [:alpha:] + [:digit:])

[:alpha:]

Alphabetic characters only

[:blank:]

Blank space characters, such as space and tab

[:cntrl:]

Nonprinting or control characters

[:digit:]

Numeric digits

[:graph:]

Graphical characters (same as [:punct:] + [:upper:] + [:lower:] + [:digit:])

[:lower:]

Lowercase letters

[:print:]

Printable characters

[:punct:]

Punctuation characters

[:space:]

Whitespace characters such as space, form-feed, newline,carriage return, horizontal tab, and vertical tab

[:upper:]

Uppercase letters

[:xdigit:]

Hexadecimal characters

Get Oracle Regular Expressions Pocket Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.