MySQL regular _ MySQL

Source: Internet
Author: User
MySQL regular 1, or

Select * from product where name regexp 'Hello | world' or

Select * from user where name regexp '[123] tom' matches any

[123] is equivalent to 1 | 2 | 3

Select * from user where name regexp '1 | 2 | 3 tom'

2. exclusion

Select * from user where name regexp '[^ 123] tom'

3. range matching

Select * from user where name regexp '[1-3] tom'

4. Escape Special characters

Select * from user where name regexp 'Linda //. cai'

5. repeated metacharacters

* 0 or more + one or more? 0 or one

{N} matches n times {n,} matches at least n times {n, m} matches between n-m times

Select * from product where name regexp '// ([0-9] sticks? //)'

Select * from product where name regexp '[: digit:] {4 }'

6. Character classes

[: Alnum:] any letter or number

[: Alpha:] any character

[: Blank:] space and tabulation

[: Digit:] any positive integer

[: Lower:] any lowercase letter

[: Upper:] any uppercase letter

[: Space:] any blank characters (including spaces)

7. positioning operator

^ Start of text

$ End of text

[[: <:] Start of a word

[[:>:] End of a word

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.