Home >Database >Mysql Tutorial >mysql中使用LIKE,正则_MySQL

mysql中使用LIKE,正则_MySQL

WBOY
WBOYOriginal
2016-06-01 13:31:541189browse

bitsCN.com

mysql中使用LIKE,正则

 

LIKE

%  表示任何字符(NULL除外)出现任意次(0--无穷个)。同时还必须注意大小写问题。

_    表示任何字符出现1(不能多也不能少)次

 

正则模式

^ $ .(匹配任意单个字符,包括换行)

[]  |

 * + ? 

(m) (m,) (m,n) (,n) 

 

mysql> select 'abcdefg' REGEXP '^a'mysql> select 'abcdef' Regexp 'g$';mysql> select 'abcdef' Regexp '.f';mysql> select 'abcdef' Regexp '[fhk]';mysql> select  name,mail,from t where mail  Regexp '@163[.,]com$';mysql> select  name,mail,from t where mail  like '@163%.com' or mail  like '@163%,com';

 

 

 

bitsCN.com
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn