本文概述
- 句法
- 例子1
- 例子2
句法
select regexp_instr('str', 'pattern', ['position']);
例子1
select regexp_instr('BCA jhon', 'BCA')
输出
![MySQL regexp_instr()函数](http://www.srcmini.com/wp-content/uploads/2020/03/mysql-regular-expression-regexp_instr-function-output1.png)
文章图片
例子2
select regexp_instr('BCA jhon', 'BCA', 1)
输出
![MySQL regexp_instr()函数](http://www.srcmini.com/wp-content/uploads/2020/03/mysql-regular-expression-regexp_instr-function-output2.png)
文章图片
推荐阅读
- MySQL Regexp运算符
- MySQL not正则表达式运算符
- MySQL函数
- MySQL存储过程
- MySQL字面量(日期和时间)
- MySQL字面量(常量)
- MySQL游标
- MySQL last()函数
- MySQL max()函数