mysql RegExp 扩展正则表达式的一些字符

REGEXP 扩展正则表达式的一些字符:

select * from beyond 


 

1. [abc]: 匹配“a”、“b”或“c”;

select * from beyond where args1 REGEXP '^[abc]' ;


 


2. [a-z]: 匹配任何字母

select * from beyond where args1 REGEXP '^[a-c]' ;


 


3. [0-9]*: 匹配任何数量的数字; *:匹配零个或多个在它前面的字符

select * from beyond where args1 REGEXP '[0-9]*' ;


 


4. .: 匹配大于零个数量的任何字符

select * from beyond where args1 REGEXP '[0-9].' ;


 


5. 模式开始处使用“^”,在模式的结尾用“$”

select * from beyond where args1 REGEXP '123$' ;
select * from beyond where args1 REGEXP '[0-9].$' ;

 



 

猜你喜欢

转载自bugyun.iteye.com/blog/2222304
今日推荐