且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

MySQL Regexp是否支持Unicode匹配

更新时间:2022-05-08 22:18:15

有人知道Mysql的regexp是否支持unicode吗?我一直在做一些研究,大多数博客等似乎都表明存在问题或不支持该问题.

Does anyone know if Mysql's regexp supports unicode? I've been doing some research and the majority of blogs etc. seem to indicate that there is a problem or its not supported.

正则表达式中所述:

警告

REGEXP

Warning

The REGEXP and RLIKE operators work in byte-wise fashion, so they are not multi-byte safe and may produce unexpected results with multi-byte character sets. In addition, these operators compare characters by their byte values and accented characters may not compare as equal even if a given collation treats them as equal.

  • 我想知道,***是将LIKE用于Unicode模式匹配,而将regexp用于ASCII增强模式匹配?

    I'm wondering then is it best to use LIKE for unicode pattern matching and regexp for ASCII enhanced pattern matching?

    是的,那是***的.

    我喜欢能够在字符串开头或结尾搜索匹配项的想法,但是如果regexp不支持unicode,那么如果我的文本是unicode,则可能会很困难.

    I Like the idea of being able to search for matches at the beginning or end of a string, but if regexp doesn't support unicode then this could be difficult if my text is unicode.

    一个人也可以用LIKE来做到这一点:

    One can do that with LIKE too:

    WHERE foo LIKE 'bar%'
    

    并且:

    WHERE foo LIKE '%bar'