当一个字段想模糊查询出多个字段的时候,正常状况下通常会这么做html
1 select * from a where name like 'a%' or name like 'b%' ....or ...;正则表达式
可是上面的状况只能对应少许的模糊查询值,过多以后再后台开发的时候会出现很是麻烦的sql语句拼接sql
这时咱们能够采用正则表达式进行匹配数据库
1 select * from a where name regexp'a|b|...';ide
原文: https://www.cnblogs.com/m-bianbian/p/5844484.htmlregexp