Mega Code Archive

 
Categories / MySQL / Regular Expression
 

Group the alternatives within parentheses, the ^ and $ will apply to both of them

mysql> mysql> mysql> SELECT '0m' REGEXP '^([[:digit:]]+|[[:alpha:]]+)$'; +---------------------------------------------+ | '0m' REGEXP '^([[:digit:]]+|[[:alpha:]]+)$' | +---------------------------------------------+ |                                           0 | +---------------------------------------------+ 1 row in set (0.00 sec) mysql>