mysql中的正则表达式

  mysql中的正则表达式表示方式跟linux中其实是一样的,mysql通过REGEXP命令提供正则表达式功能:

a(m,n)匹配m到n个a

a(,n)匹配0到n个a

root@localhost:cyz--08:14:42 >create table test(id int auto_increment primary key,email varchar(20));
Query OK, 0 rows affected (0.01 sec)

root@localhost:cyz--08:15:03 >insert into test values(1,'abc@163.com'),(2,'def@162.com'),(3,'jjj@111.com');
Query OK, 3 rows affected (0.00 sec)
Records: 3 Duplicates: 0 Warnings: 0

root@localhost:cyz--08:16:14 >select * from test where email regexp '[1.]';
+----+-------------+
| id | email |
+----+-------------+
| 1 | abc@163.com |
| 2 | def@162.com |
| 3 | jjj@111.com |
+----+-------------+
3 rows in set (0.00 sec)

你将来想成为什么样子,就一定会成为什么样子,只要你努力坚持的去做!!!
原文地址:https://www.cnblogs.com/kucha/p/4837633.html