May I ask you how MySQL search can use regular to query a specific number AH?
For example, if I want to query a column with 115 numbers in a field but want to exclude 1115 or 11555555, does MySQL support this query?
Reply content:
May I ask you how MySQL search can use regular to query a specific number AH?
For example, if I want to query a column with 115 numbers in a field but want to exclude 1115 or 11555555, does MySQL support this query?
Compared to the MySQL manual wrote a bit, writing is ugly, no way, did not find \d, (|[ ^0-9X]) also give me an error, alas. mysql5.5.24
mysql> select '115' regexp '^115$|^115[^0-9X]|[^0-9X]115$|[^0-9X]115[^0-9X]' result;+--------+| result |+--------+| 1 |+--------+1 row in set (0.00 sec)mysql> select '1150' regexp '^115$|^115[^0-9X]|[^0-9X]115$|[^0-9X]115[^0-9X]' result;+--------+| result |+--------+| 0 |+--------+1 row in set (0.00 sec)mysql> select '11150' regexp '^115$|^115[^0-9X]|[^0-9X]115$|[^0-9X]115[^0-9X]' result;+--------+| result |+--------+| 0 |+--------+1 row in set (0.00 sec)mysql> select 'a115a' regexp '^115$|^115[^0-9X]|[^0-9X]115$|[^0-9X]115[^0-9X]' result;+--------+| result |+--------+| 1 |+--------+1 row in set (0.00 sec)
Not supported, inefficient and needs to be handled by itself.
Support, but not high efficiency.
SELECT mm,mm REGEXP '. asterisk [^1]115[^5]. Asterisk $ ' from test.a;