24.4. REGEXP

简介:

正则匹配

判断非数字字符

select '看89700' regexp '^[0-9]+$'
select '89看700' regexp '^[0-9]+$'
select '89700看' regexp '^[0-9]+$'
		

应用到实际工作中

select count(*) from accounts a where a.name != '' and not a.name regexp '^[0-9]+$';
select count(*) from accounts a,members m where  a.member = m.id  and a.name != '' and  not a.name regexp '^[0-9]+$' group by member;
SELECT * FROM tablename WHERE SUBSTRING(fieldname, 1, 1) REGEXP '[[:digit:]]';
		





原文出处:Netkiller 系列 手札
本文作者:陈景峯
转载请与作者联系,同时请务必标明文章原始出处和作者信息及本声明。

目录
相关文章
|
10月前
replace、replaceAll、replaceFirst
replace、replaceAll、replaceFirst
44 0
|
SQL
LIKE与REGEXP的区别
LIKE与REGEXP的区别
424 0
|
JavaScript 前端开发
js:使用正则RegExp实现字符串全部替换replaceAll
js:使用正则RegExp实现字符串全部替换replaceAll
131 0
lodash如何转义RegExp字符串
lodash如何转义RegExp字符串
142 0
4.4、RegExp正则表达式对象
4.4、RegExp正则表达式对象
95 0
4.4、RegExp正则表达式对象
|
移动开发 JavaScript 前端开发
26、RegExp 对象
正则表达式(regular expression)是一种表达文本模式(即字符串结构)的方法,有点像字符串的模板,常常用来按照“给定模式”匹配文本。
155 0
|
SQL Java 流计算
|
JavaScript 前端开发 Java