开发者

How to get all rows that contain characters others than [a-zA-Z] in MySQL

开发者 https://www.devze.com 2023-01-05 01:50 出处:网络
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 f

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 Gr开发者_高级运维eek, French.

For example if the table contains the following data:

-- ID, Address --
|  1, "Test1"   | 
|  2, "Tåst2"   |
|  3, "Test1"   |

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]';

But no luck!

Any help would be appreciated!


Match the whole text

SELECT * 
FROM contact_info 
WHERE address NOT REGEXP '^[a-zA-Z0-9]*$';
0

精彩评论

暂无评论...
验证码 换一张
取 消