当前位置:网站首页>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$';
边栏推荐
猜你喜欢
代码随想录笔记_动态规划_1049最后一块石头的重量II
本周讨论用户体验:Daedalus 的 Nemo 加入 Ambire,探索加密海洋
理论篇1:深度学习之----LetNet模型详解
【Web技术】1401- 图解 Canvas 入门
Unity插件:使用PopulationSystem制作行走交流的路人
MySQL【窗口函数】【共用表表达式】
Lixia Action | Kyushu Yunzhang Jinnan: Open source is not a movement for a few people, popularization is the source
[Beiya data recovery] IBM System Storage storage lvm information lost data recovery solution
砺夏行动|九州云章津楠:开源不是少数人的运动,大众化才是源泉
Rust from entry to proficient 04-variables
随机推荐
CCF GLCC正式开营|九州云开源专家携丰厚奖金,助力高校开源推广
Phasecraft连下两城,助力英国量子技术商业化加速!
企业级优化
考研上岸又转行软件测试,从5k到13k完美逆袭,杭州校区小哥哥拒绝平庸终圆梦!
实际工作中的高级技术(训练加速、推理加速、深度学习自适应、对抗神经网络)
化繁为简,聊一聊复制状态机系统架构抽象
兆骑科创创新创业大赛活动举办,线上直播路演,投融资对接
【历史上的今天】8 月 4 日:第一位图灵奖女性得主;NVIDIA 收购 MediaQ;首届网络安全挑战大赛完成
token 过期后,如何自动续期?
七夕邂逅爱,那人一定在
Notes for xpath getting node with namespace
Workaround without Project Facets
代码随想录笔记_动态规划_1049最后一块石头的重量II
How to write SQL statements: the usage of Update, Case, and Select together
Android Sqlite3 basic commands
手搓一个“七夕限定”,用3D Engine 5分钟实现烟花绽放效果
16、学习MySQL 正则表达式
ICML 2022 | 图神经网络的局部增强
用了TCP协议,就一定不会丢包吗?
oracle+RAC+linux5.1所需要安装的包