如何在MySQL中获取所有包含除[a-zA-Z]以外的字符的行 [英] How to get all rows that contain characters others than [a-zA-Z] in MySQL
本文介绍了如何在MySQL中获取所有包含除[a-zA-Z]以外的字符的行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想问问是否有可能从表中选择所有行,其中列的内容(varchar(255))可能包含标准英语(a-zA-Z)以外的其他字符或不同的语言,例如希腊语,法语.
I would like to ask if there is a possible way to select all rows from a table where the content of a column (varchar(255)) may contain characters others than standard english (a-zA-Z) or characters from different languages like Greek, French.
例如,如果表包含以下数据:
For example if the table contains the following data:
-- ID, Address --
| 1, "Test1" |
| 2, "Tåst2" |
| 3, "Test1" |
我只想获得第二行(2,Tåst2")
I would like to get only the 2nd row (2, "Tåst2")
我尝试使用正则表达式执行以下操作:
I tried to use regular expression doing the following:
SELECT * FROM contact_info WHERE address NOT REGEXP '[a-zA-Z]';
但是没有运气!
任何帮助将不胜感激!
推荐答案
匹配整个文本
SELECT *
FROM contact_info
WHERE address NOT REGEXP '^[a-zA-Z0-9]*$';
这篇关于如何在MySQL中获取所有包含除[a-zA-Z]以外的字符的行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文