Mega Code Archive

 
Categories / MySQL / Regular Expression
 

Curly braces group abc as a whole, and square brackets allow any of a, or b, or c to match, allowing a whole range of o

mysql> mysql> SELECT 'abcbbcccc' REGEXP '[abc]{3}'; +-------------------------------+ | 'abcbbcccc' REGEXP '[abc]{3}' | +-------------------------------+ |                             1 | +-------------------------------+ 1 row in set (0.00 sec) mysql> mysql> SELECT 'abcbbcccc' REGEXP '(a|b|c){3}'; +---------------------------------+ | 'abcbbcccc' REGEXP '(a|b|c){3}' | +---------------------------------+ |                               1 | +---------------------------------+ 1 row in set (0.00 sec) mysql>