expr REGEXP pat, expr RLIKE pat: Performs a pattern match of expr against pat : REGEXP « String Functions « MySQL Tutorial






Returns 1 if expr matches pat; otherwise it returns 0.

If either expr or pat is NULL, the result is NULL.

REGEXP is not case sensitive, except when used with binary strings.

RLIKE is a synonym for REGEXP.

mysql>
mysql>
mysql> SELECT 'ABCDEF' REGEXP 'A%C%%';
+-------------------------+
| 'ABCDEF' REGEXP 'A%C%%' |
+-------------------------+
|                       0 |
+-------------------------+
1 row in set (0.00 sec)

mysql> SELECT 'ABCDE' REGEXP '.*';
+---------------------+
| 'ABCDE' REGEXP '.*' |
+---------------------+
|                   1 |
+---------------------+
1 row in set (0.00 sec)

mysql> SELECT 'new*\n*line' REGEXP 'new\\*.\\*line';
+---------------------------------------+
| 'new*\n*line' REGEXP 'new\\*.\\*line' |
+---------------------------------------+
|                                     1 |
+---------------------------------------+
1 row in set (0.00 sec)

mysql>








23.31.REGEXP
23.31.1.expr REGEXP pat, expr RLIKE pat: Performs a pattern match of expr against pat
23.31.2.SELECT 'a' REGEXP 'A', 'a' REGEXP BINARY 'A';