[ : Character_class : Regular Expressions MySQL TUTORIALS


MySQL TUTORIALS » Regular Expressions » Character_class »

 

[


[=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.

alnum Alphanumeric characters
alpha Alphabetic characters
blank Whitespace characters
cntrl Control characters
digit Digit characters
graph Graphic characters
lower Lowercase alphabetic characters
print Graphic or space characters
punct Punctuation characters
space Space, tab, newline, and carriage return
upper Uppercase alphabetic characters
xdigit Hexadecimal digit characters


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

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

mysql>



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .

Follow Navioo On Twitter

MySQL TUTORIALS

 Navioo Regular Expressions
» Character_class