您好,欢迎访问一九零五行业门户网

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、定位符
       ^ 文本的开头
       $ 文本的结尾
       [[:       [[:>:]] 词的末尾
其它类似信息

推荐信息