您好,欢迎来到叨叨游戏网。
搜索
您的当前位置:首页MySQL正则_MySQL

MySQL正则_MySQL

来源:叨叨游戏网


1、或

select * from product where name regexp 'hello|world' 或

select * from user where name regexp '[123] tom' 匹配任意一个

其中[123]相当于 1|2|3

select * from user where name regexp '1|2|3 tom'

2、排除

select * from user where name regexp '[^123] tom'

3、范围匹配

select * from user where name regexp '[1-3] tom'

4、转义特殊字符

select * from user where name regexp 'linda//.cai'

5、重复元字符

* 0个或多个 + 一个或多个 ?0个或一个

{n}匹配n次 {n,}匹配至少n次 {n,m}匹配次数在n-m之间

select * from product where name regexp '//([0-9] sticks?//)'

select * from product where name regexp '[:digit:]{4}'

6、字符类

[:alnum:] 任意字母和数字

[:alpha:] 任意字符

[:blank:] 空格和制表

[:digit:] 任意正整数

[:lower:] 任意小写字母

[:upper:] 任意大写字母

[:space:] 任意空白字符(包括空格)

7、定位符

^ 文本的开头

$ 文本的结尾

[[:<:]] 词的开始

[[:>:]] 词的末尾

Copyright © 2019- gamedaodao.net 版权所有 湘ICP备2024080961号-6

违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务