[:character_class:] represents a character class that matches all characters belonging to that class : character_class « Regular Expressions « MySQL Tutorial






[=character_class=] represents an equivalence class.

It matches all characters with the same collation value, including itself.

For example, if o and (+) are the members of an equivalence class, then [[=o=]], [[=(+)=]], and [o(+)] are all synonymous.

An equivalence class may not be used as an endpoint of a range.

The following table lists the standard class names.

alnumAlphanumeric characters
alphaAlphabetic characters
blankWhitespace characters
cntrlControl characters
digitDigit characters
graphGraphic characters
lowerLowercase alphabetic characters
printGraphic or space characters
punctPunctuation characters
spaceSpace, tab, newline, and carriage return
upperUppercase alphabetic characters
xdigitHexadecimal digit characters


mysql> SELECT 'ABC' REGEXP '[[:alnum:]]+';
+-----------------------------+
| 'ABC' REGEXP '[[:alnum:]]+' |
+-----------------------------+
|                           1 |
+-----------------------------+
1 row in set (0.00 sec)

mysql>
mysql> SELECT 'ABC123' REGEXP '[[:alnum:]]+';
+--------------------------------+
| 'ABC123' REGEXP '[[:alnum:]]+' |
+--------------------------------+
|                              1 |
+--------------------------------+
1 row in set (0.00 sec)

mysql>








24.6.character_class
24.6.1.[:character_class:] represents a character class that matches all characters belonging to that class
24.6.2.'[[:alnum:]]' -- Alphanumeric characters
24.6.3.[[:alpha:]] -- Alphabetic characters
24.6.4.[[:blank:]] -- Whitespace characters
24.6.5.'[[:cntrl:]]' -- Control characters
24.6.6.'[[:digit:]]' -- Digit characters
24.6.7.'[[:graph:]]' -- Graphic characters
24.6.8.'[[:lower:]]' -- Lowercase alphabetic characters
24.6.9.'[[:print:]]' -- Graphic or space characters
24.6.10.'[[:punct:]]' -- Punctuation characters
24.6.11.'[[:space:]]' -- Space, tab, newline, and carriage return
24.6.12.'[[:upper:]]' -- Uppercase alphabetic characters
24.6.13.'[[:xdigit:]]' -- Hexadecimal digit characters