参考:
-- 创建表 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://images2017.cnblogs.com/blog/890017/201711/890017-20171107161643169-1391195646.png)
![](https://images2017.cnblogs.com/blog/890017/201711/890017-20171107161643591-902346849.png)
![](https://images2017.cnblogs.com/blog/890017/201711/890017-20171107161644169-1828111171.png)
![](https://images2017.cnblogs.com/blog/890017/201711/890017-20171107161644528-796285554.png)
![](https://images2017.cnblogs.com/blog/890017/201711/890017-20171107161644809-120040398.png)
![](https://images2017.cnblogs.com/blog/890017/201711/890017-20171107161645169-1067663323.png)