REGEXP_LIKE,REGEXP_INSTR,REGEXP_SUBSTR,REGEXP_REPLACE
Posted tonghaolang
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了REGEXP_LIKE,REGEXP_INSTR,REGEXP_SUBSTR,REGEXP_REPLACE相关的知识,希望对你有一定的参考价值。
参考:
-- 创建表 create table REGLIKE ( id NUMBER(3), name VARCHAR2(20) ); --添加记录 insert into REGLIKE (id, name) values (1, \'aaa111\'); insert into REGLIKE (id, name) values (2, \'aaa222\'); insert into REGLIKE (id, name) values (3, \'aaa333\'); insert into REGLIKE (id, name) values (4, \'333aaa\'); insert into REGLIKE (id, name) values (5, \'222aaa\'); insert into REGLIKE (id, name) values (6, \'111aaa\'); commit; --使用 select * from reglike; select * from reglike where regexp_like(name,\'^[a-z]\'); select * from reglike where regexp_like(name,\'[a-z]$\'); select REGEXP_INSTR (name,\'[a-z]{3}\') position from reglike ; select REGEXP_SUBSTR (name,\'[a-z]{3}\') str from reglike ; select REGEXP_REPLACE (name,\'[a-z]{1}\',\'bbb\',2,2) str from reglike ;
![](https://image.cha138.com/20210607/0148566399cf4590aa04a157c208b774.jpg)
![](https://image.cha138.com/20210607/b9dc3fb5dc274d27bbdfba703ab64b53.jpg)
![](https://image.cha138.com/20210607/02bb599c342b4cbd81811c7d4e1f5ac9.jpg)
![](https://image.cha138.com/20210607/046762dcc646436baafe371654ed5bce.jpg)
![](https://image.cha138.com/20210607/0b1a9e038d3b47e4b112ec31fb959450.jpg)
![](https://image.cha138.com/20210607/f59733468e354187937400a5626ab983.jpg)
以上是关于REGEXP_LIKE,REGEXP_INSTR,REGEXP_SUBSTR,REGEXP_REPLACE的主要内容,如果未能解决你的问题,请参考以下文章
oracle 判断字段是否为是数字等 regexp_like用法 正则表达式