SELECT '1+2' REGEXP '1\\+2'; : REGEXP « Regular Expressions « MySQL Tutorial






mysql>
mysql>
mysql>
mysql> SELECT '1+2' REGEXP '1+2';
+--------------------+
| '1+2' REGEXP '1+2' |
+--------------------+
|                  0 |
+--------------------+
1 row in set (0.00 sec)

mysql> SELECT '1+2' REGEXP '1\+2';
+---------------------+
| '1+2' REGEXP '1\+2' |
+---------------------+
|                   0 |
+---------------------+
1 row in set (0.00 sec)

mysql> SELECT '1+2' REGEXP '1\\+2';
+----------------------+
| '1+2' REGEXP '1\\+2' |
+----------------------+
|                    1 |
+----------------------+
1 row in set (0.00 sec)

mysql>








24.10.REGEXP
24.10.1.Characters and classes used by the REGEXP and NOT REGEXP operators (or RLIKE and NOT RLIKE, which are synonyms)
24.10.2.To find names beginning with 'J', use '^' to match the beginning of the name
24.10.3.To matches only lowercase 'b' at the beginning of a name
24.10.4.To find names ending with 'es', use '$' to match the end of the name
24.10.5.To find names containing an 'e', use this query
24.10.6.To find names containing exactly five characters
24.10.7.To find names containing exactly five characters using {n}
24.10.8.SELECT '1+2' REGEXP '1\\+2';
24.10.9.REGEXP '^[a-f]'
24.10.10.REGEXP '^[mn].*[sz]$'