表t1,字段c1 类型 varchar
现在要求MYSQL中实现以下
1.过滤出c1所有包括数字的数据
2.过滤出c1所有包括英文字母(分大写,小写字母)的数据
3.过滤出c1所有包括中文的数据以上3个要求在SQLSERVER中实现的方式是
1.where c1 like '%[0-9]%'
2.where c1 like '%[a-z]%' or c1 like '%[A-Z]%'
3.where c1 like '%[阿-座]%'
谢谢大家!
现在要求MYSQL中实现以下
1.过滤出c1所有包括数字的数据
2.过滤出c1所有包括英文字母(分大写,小写字母)的数据
3.过滤出c1所有包括中文的数据以上3个要求在SQLSERVER中实现的方式是
1.where c1 like '%[0-9]%'
2.where c1 like '%[a-z]%' or c1 like '%[A-Z]%'
3.where c1 like '%[阿-座]%'
谢谢大家!
2.where c1 regexp '[a-z]' or c1 regexp '[A-Z]'
3.where c1 regexp '[阿-座]'
2.where c1 regexp '[a-z]' or '[A-Z]'
3.where c1 regexp '[阿-座]'
2
WHERE c1 REGEXP '[^ -~]'<>1
3、
假设使用UTF8字符集
WHERE c1 REGEXP '[^ -~]'=1
针对楼主三个要求的正则表达式有很多。如果在网页开发版咨询估计每种不下几十种。1.过滤出c1所有包括数字的数据
regexp '[0-9]'
regexp '[0123456789]'
regexp '[[:digit:]]';
...2.过滤出c1所有包括英文字母(分大写,小写字母)的数据
regexp '[A-Za-z]'
regexp '[[:alpha:]]';
....
3.过滤出c1所有包括中文的数据
包括数字 字母
WHERE C1 REGEXP '^[A-Za-z0-9]+$'
3
包括中文
WHERE c1 REGEXP '[^ -~]'=1