MySQL Regular expression

Source: Internet
Author: User

Regular expressions are also supported in MySQL and usually have good results, and the usual regular ones are as follows:

Select *  from where ' Regular Expressions ';

1. String starting with Xiaomi or ending with 06

Select *  from where ' ^xiaomi|06$ ';

2. Start with Xiaomi and end with 06, with strings in the middle containing any other characters

Select *  from where ' ^xiaomi.+06$ ';

Note: point "." When in a character group, the input represents a normal character point, and any character outside the group of characters ,+ " one or more"in the regular, so the above regex does not match "xiaomi06" So there are no strings of other characters in the middle .

3. Start with Xiaomi and end with 06, middle can have no character, or can have any character string

Select *  from where ' ^xiaomi.*06$ ';

In regular expressions, * stands for "0 or more", so the above can match both Xiaomi06 and XiaomiHEHE06.

MySQL Regular expression

Related Article

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.