参考:
-- 创建表 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 ;