Mysql的正規表示式查詢

2021-06-10 21:18:55 字數 728 閱讀 5158

select * from info where name regexp '^l';

select * from info where name regexp '^aaa';

select * from info where name regexp 'c$';

select * from info where name regexp 'aaa$';

select * from info where name regexp '^l..y$';

select * from info where name regexp '[ceo]';  

select * from info where name regexp '[0-9]';

select * from info where name regexp '[0-9a-c]';

select * from info where name regexp 'ic';

select * from info where name regexp 'ic|uc|ab';

select * from info where name regexp 'a*c';

select * from info where name regexp 'a+c';

select * from info where name regexp 'ab';

select * from info where name regexp 'a';

MYSQL 正規表示式查詢!

在使用select查詢的過程中,有時會用到正規表示式對結果進行查詢,將學習到的內容進行總結!一 語法結構如下 二 常用匹配方式進行示例說明 首先建立表student,表的結構如下 查詢student表中sname列已 王 開始的姓名 select sname from student where s...

mysql正規表示式 MySQL正規表示式

正規表示式是為複雜搜尋指定模式的強大方式。正規表示式描述了一組字串。最簡單的正規表示式是不含任何特殊字元的正規表示式。例如,正規表示式hello匹配hello。非平凡的正規表示式採用了特殊的特定結構,從而使得它們能夠與1個以上的字串匹配。例如,正規表示式hello word匹配字串hello或字串w...

MySQL 使用正規表示式查詢

字元 匹配特定字元 select from fruits where f name regexp b 字元 特定字元結尾 select from fruits where f name regexp y 字元 代替字串中的任意乙個字元 select from fruits where f name ...