当前位置:网站首页>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$';边栏推荐
- Lixia Action | Kyushu Yunzhang Jinnan: Open source is not a movement for a few people, popularization is the source
- 【模型部署与业务落地】基于量化芯片的损失分析
- FRED应用:毛细管电泳系统
- Rust from entry to proficient 04-variables
- 兆骑科创创新创业大赛活动举办,线上直播路演,投融资对接
- How to automatically renew the token after it expires?
- Workaround without Project Facets
- leetcode:215无序数组中找第k大的元素
- [Opportunity Enlightenment-60]: "Soldiers, Stupid Ways"-1- Opening: "Death" and "Life" are the way of heaven
- Bluetooth Technology|In the first half of the year, 1.3 million charging piles were added nationwide, and Bluetooth charging piles will become the mainstream of the market
猜你喜欢
随机推荐
ACL 2022 | 社会科学理论驱动的言论建模
Keycloak 6.0.0 正式发布,身份和访问管理系统
vim 常用操作命令
并发程序的隐藏杀手——假共享(False Sharing)
基于 Next.js实现在线Excel
[Problem solving] QT update component appears "To continue this operation, at least one valid and enabled repository is required"
Makefile 语法及使用笔记
js深拷贝和浅拷贝具体使用区别_es6深拷贝和浅拷贝
LCP 06. 拿硬币-遍历
Win10无法访问移动硬盘怎么解决
技术分享| 融合调度系统中的电子围栏功能说明
如何确定异步 I/O 瓶颈
在腾讯,我的试用期总结!
Set partition minimum difference problem (01 knapsack)
特殊品种的二次开户验资金额
leetcode:241. 为运算表达式设计优先级
期货开户之前要谈好最低手续费和交返
手搓一个“七夕限定”,用3D Engine 5分钟实现烟花绽放效果
How to install postgresql and configure remote access in ubuntu environment
蓝牙技术|上半年全国新增 130 万台充电桩,蓝牙充电桩将成为市场主流









