当前位置:网站首页>16. Learn MySQL Regular Expressions
16. Learn MySQL Regular Expressions
2022-08-04 14:36:00 【Microservice spring cloud】
MySQL Regular Expression
In the previous chapter we have learned that MySQL can perform fuzzy matching through LIKE ...% .
MySQL also supports the matching of other regular expressions. MySQL uses the REGEXP operator for regular expression matching.
If you know PHP or Perl, it's pretty straightforward, as MySQL's regular expression matching is similar to those of these scripts.
The regular patterns in the table below can be applied to the REGEXP operator.
Instance
After understanding the above regular requirements, we can write SQL statements with regular expressions according to our own requirements.Below we will list a few small examples (table name: person_tbl ) to deepen our understanding:
Find all data starting with 'st' in the name field:
mysql> SELECT name FROM person_tbl WHERE name REGEXP '^st';
Find all data in the name field that ends with 'ok':
mysql> SELECT name FROM person_tbl WHERE name REGEXP 'ok$';
Find all data containing the string 'mar' in the name field:
mysql> SELECT name FROM person_tbl WHERE name REGEXP 'mar';
Finds all data in the name field that begins with a vowel character or ends with the string 'ok':
mysql> SELECT name FROM person_tbl WHERE name REGEXP '^[aeiou]|ok$';
边栏推荐
猜你喜欢
centos7安装mysql急速版
【Today in History】August 4: First female Turing Award winner; NVIDIA acquires MediaQ; first Cybersecurity Challenge completed
Theory 1: Deep Learning - Detailed Explanation of the LetNet Model
Problem solving-->Online OJ (18)
【模型部署与业务落地】基于量化芯片的损失分析
【剑指offer59】队列的最大值
利用决策树找出最优特征组合
Redis 复习计划 - Redis主从数据一致性和哨兵机制
xampp安装包含的组件有(php,perl,apche,mysql)
九州云出席领航者线上论坛,共话5G MEC边缘计算现状、挑战和未来
随机推荐
本周讨论用户体验:Daedalus 的 Nemo 加入 Ambire,探索加密海洋
token 过期后,如何自动续期?
License server system does not support this version of this feature
CCF GLCC正式开营|九州云开源专家携丰厚奖金,助力高校开源推广
字符串类的设计与实现_C语言字符串编程题
阿里老鸟终于把测试用例怎么写说的明明白白了,小鸟必看
Qt的QItemDelegate使用
AlphaFold 如何实现 AI 在结构生物学中的全部潜力
G. Mountaineering Squad (violence & dfs)
leetcode:251. 展开二维向量
广告电商系统开发功能只订单处理
Unity插件:使用PopulationSystem制作行走交流的路人
js深拷贝和浅拷贝具体使用区别_es6深拷贝和浅拷贝
Lecture 4 SVN
How to automatically renew the token after it expires?
Oracle RAC环境下vip/public/private IP的区别
[in-depth study of 4 g / 5 g / 6 g project - 50] : URLLC - 16 - the 3 GPP URLLC agreement, specification, technical principle of depth interpretation - 10 - high reliability technology - 1 - low codin
杭电校赛(逆袭指数)
《中国综合算力指数》《中国算力白皮书》《中国存力白皮书》《中国运力白皮书》在首届算力大会上重磅发出
JCMsuite应用:倾斜平面波传播透过光阑的传输