0

我需要在 mysql 表中找到 é ou è 的出现。

第一次尝试: SELECT "LéL" like "%é%"; 这不起作用:它返回包含 e 或 é 或 è 的单词。

我还尝试了没有结果的正则表达式(使用字母 L):

SELECT "Lbc" REGEXP ".*L.*";  -- works : it finds L in the string LBC

SELECT "Lbc" REGEXP ".*\u4C.*"; -- doesn't work : can't find the hexadecimal equivalent of L in the string LBC.

我想测试 \u 加十六进制搜索...我还尝试了文档中提到的双重转义而不做任何更改。

正则表达式搜索似乎在 mysql 中非常有限。在http://dev.mysql.com/doc/refman/4.1/en/regexp.html上没有找到任何与 \u 相关的文档。

我正在使用 mysql 4.1。

如果 mysql 5 中有一个在 4 中不存在的解决方案,我想知道它。

4

1 回答 1

1
SELECT 'LéL' LIKE '%é%' COLLATE utf8_bin;
/* latin1_bin if your data is in latin1, etc. */
1

SELECT 'LéL' LIKE '%e%' COLLATE utf8_bin;
0

http://dev.mysql.com/doc/refman/5.0/en/string-comparison-functions.html#operator_likehttp://dev.mysql.com/doc/refman/5.0/en/charset-binary -collat​​ions.html

在 MySQL 5.1 中测试 - 也应该在 4.1 中工作。

于 2009-09-04T19:30:12.313 回答