MySQL regular expression-php Tutorial

Source: Internet
Author: User
Problem 1 of MySQL regular expression: match a table with four letters or less.
For example, "asd" matches, "123asd" matches, and "Chinese asd" matches.
That is, the matching object contains only four letters.
Question 2: match a table that contains more than three Chinese characters.
For example, "Good Chinese sss" can be matched, and "good Chinese aaa cannot match"
^ [\ U4E00-\ u9FFF] {3,} $ has already tried, no
Question 3: match a table that contains less than three Chinese characters.
Same as above.


Reply to discussion (solution)

Look at this article http://wenku.baidu.com/link? Url = NWcSSZbPMI-tW4PE1xrU2mY6t70nQX4V4IjlooTugCij7SdGOGsBVMQkJE9qy5RDVldewTrl2eWdYSoXnIPOnbeY0y2d5uKeRbnKI3GIQ3S

Look at this article http://wenku.baidu.com/link? Url = NWcSSZbPMI-tW4PE1xrU2mY6t70nQX4V4IjlooTugCij7SdGOGsBVMQkJE9qy5RDVldewTrl2eWdYSoXnIPOnbeY0y2d5uKeRbnKI3GIQ3S

The moderator replied. haha.
But this cannot be used ....

Why not?

Why not?

The search results are in full English.

How did you write it?

How did you write it?


SELECT * FROM t_products WHERE ProName REGEXP '^ [\ u4E00-\ u9FA5] {1, 4} $'

Have you read the link I gave you? It seems that you did not look at it!
Please take a look.

Have you read the link I gave you? It seems that you did not look at it!
Please take a look.



^ [\ U4e00-\ u9fa5] {} I also tried this. I just added a new repeat number. $ I want to try it,
[\ U4e00-\ u9fa5] this does not seem to work for me.

And not (ProName REGEXP '[\ u0391-\ uFFE5]') I write this statement that only contains Chinese characters, but it won't work if it contains more than three characters.

Why don't you see the link I gave?

Why don't you see the link I gave?


Isn't it?

Solved. haha, thank you.

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.