当前位置:网站首页>MySQL必知必会-第九章-用正则表达式进行搜索
MySQL必知必会-第九章-用正则表达式进行搜索
2022-06-21 18:12:00 【山东馍馍】
基本字符匹配
SELECT prod_name FROM products WHERE prod_name REGEXP '1000' ORDER BY prod_name;
- 默认不区分大小写,可以添加BINARY关键字区分,如:
- SELECT prod_name FROM products WHERE prod_name REGEXP BINARY ‘1000’ ORDER BY prod_name;
进行OR匹配
- | 为正则表达式中的OR操作符,两个以上的OR条件可以使用多个|
SELECT prod_name FROM products WHERE prod_name REGEXP '1000|2000' ORDER BY prod_name;
匹配几个字符之一
- [123]相当于[1|2|3],[^123]表示匹配123以外的字符
SELECT prod_name FROM products WHERE prod_name REGEXP '[123] Ton' ORDER BY prod_name;
匹配范围
- [1-9] [a-z]表示匹配范围内的任意字符
SELECT prod_name FROM products WHERE prod_name REGEXP '[1-5] Ton' ORDER BY prod_name;
匹配特殊字符
| 元字符 | 说明 |
|---|---|
| \f | 换页 |
| \n | 换行 |
| \r | 回车 |
| \t | 制表 |
| \v | 纵向制表 |
匹配字符类
| 类 | 说明 |
|---|---|
| :lower: | 任意小写字母 |
匹配多个实例
| 元字符 | 说明 |
|---|---|
| * | 0个或多个匹配 |
| + | 1个或多个匹配 |
| ? | 0个或一个匹配 |
| {n} | 指定数目的匹配 |
| {n,} | 不少于指定数目的匹配 |
| {n,m} | 匹配数目的范围 m<255 |
定位符
| 元字符 | 说明 |
|---|---|
| ^ | 文本的开始 |
| $ | 文本的结尾 |
| [[:<:]] | 词的开始 |
| [[:>:]] | 词的结尾 |
边栏推荐
- R language uses neuralnet package to build neural network regression model (feedforward neural network regression model), visualize the scatter diagram between the actual target value and the predicte
- 【面试高频题】难度 1/5,热门枚举类模拟题
- Nebula Graph入驻阿里云计算巢,助力企业打造云上超大规模图数据库
- Whether Gorm database needs to set foreign keys
- How to use devaxpress WPF to create the first MVVM application in winui?
- 【区间和专题の前缀和】线段树(动态开点)运用题
- CPDA|数据分析师需要具备哪些基本功?
- [high frequency interview questions] difficulty 1/5, popular enumeration simulation questions
- Kubernetes 跨 StorageClass 迁移 Persistent Volumes 完全指南
- 【综合笔试题】难度 2.5/5 :「树状数组」与「双树状数组优化」
猜你喜欢

使用uniapp框架搭建浙里办微应用(单点登录、埋点、适老化、RPC网关)

LeetCode个人题解(剑指offer 21-25)21. 调整数组顺序使奇数位于偶数前面,22. 链表中倒数第k个节点,24. 反转链表,25. 合并两个排序的链表

Nepal graph has settled in Alibaba cloud computing nest to help enterprises build a super large-scale map database on the cloud

一种简单的架构设计逻辑|得物技术

How to set the picture background to transparent

出院小结识别api接口-医疗票据OCR识别/出院诊断记录/电子病历/理赔服务

Tensorflow 2: use neural network to classify and compare fashion MNIST

Shang Silicon Valley Shang Silicon Valley | what is Clickhouse table engine memory and merge

Introduction to setting program icon in QT

jvm造轮子
随机推荐
Jupyter Notebook启动方式及相关问题
转发提醒 MetaMask小狐狸钱包安全公告 如何应对拓展程序潜在的私钥泄露
In the same process of go question bank · 9, what is the problem with sending and receiving data at the same time for unbuffered channels
DataGear 使用坐标映射表制作地理坐标数据可视化看板
CloudCompare&PCL 点云点匹配(基于欧式距离)
一种简单的架构设计逻辑|得物技术
How to use devaxpress WPF to create the first MVVM application in winui?
Nepal graph has settled in Alibaba cloud computing nest to help enterprises build a super large-scale map database on the cloud
R语言使用neuralnet包构建神经网络回归模型(前馈神经网络回归模型),可视化测试集中实际目标值与预测值之间的散点图并分析模型预测的可靠性
Patch package cannot be used to patch pnpm
Flink 系例 之 TableAPI & SQL 与 示例模块
使用 POST 向 ASP.NET Core 传递数据时的长度限制与解决方案
Write down some pat topics (I)
Literature analysis CiteSpace 6.1.2 download and installation tutorial
gorm数据库是否需要设置外键
论文解读(USIB)《Towards Explanation for Unsupervised Graph-Level Representation Learning》
记一些PAT题目(一)
What is the process of futures account opening? Is it safe to open an account online
根据数据中的key获取value值
【综合笔试题】难度 2.5/5 :「树状数组」与「双树状数组优化」