Does MySQL query support regular numbers?

Source: Internet
Author: User
Tags mysql manual
How can I query a specific number through regular expressions in mysql search? For example, if I want to query columns with 115 numbers in a field, but want to exclude 1115 or 11555555, does mysql support this query? How can I query a specific number through regular expressions in mysql search?
For example, if I want to query columns with 115 numbers in a field, but want to exclude 1115 or 11555555, does mysql support this query?

Reply content:

How can I query a specific number through regular expressions in mysql search?
For example, if I want to query columns with 115 numbers in a field, but want to exclude 1115 or 11555555, does mysql support this query?

Compared with the mysql manual, the script is ugly and cannot be written. \ D and (| [^ 0-9X]) are not found, and an error is also reported to me. 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. The efficiency is too low and needs to be handled by yourself.

Yes, but the efficiency is not high.
SELECT mm, mm REGEXP '. Asterisk [^ 1] 115 [^ 5]. Asterisk $' FROM test.;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.