mysql 中用于检查名称的 PHP 正则表达式包含重音字母和名称长度大于 5


PHP Regular expression in mysql to check for name contains accented letters and length of name greater than 5

如何使用正则表达式为以下场景编写查询。

id name
1  Müllere
2  Kees
3  Hernández
4  Björn

上面给出的是我的MySQL表。我想得到结果,名称包含重音字母和名称长度大于 5

尝试以下查询:

Select * from test where Length(name) > '5' and name REGEXP '[accentedcharacters]+';
WHERE length(name) > 5 and name REGEXP '[accentedcharacters]+' 

但是,我不确定重音字符的mysql REGEXP

[1] http://dev.mysql.com/doc/refman/5.0/en/regexp.html

SELECT * FROM letters
+--------+
| letter |
+--------+
| '      |
| -      |
| a      |
| b      |
| c      |
| d      |
| e      |
| f      |
| g      |
| h      |
| i      |
| j      |
| k      |
| l      |
| m      |
| n      |
| o      |
| p      |
| q      |
| r      |
| s      |
| t      |
| u      |
| v      |
| w      |
| x      |
| y      |
| z      |
| å      |
| ä      |
| ö      |
| ÿ      |
+--------+
SELECT *
  FROM letters
 WHERE letter NOT REGEXP '[a-z''|A-Z'-]';
+--------+
| letter |
+--------+
| å      |
| ä      |
| ö      |
| ÿ      |
+--------+