首页 > 其他 > 详细

REGEXP_LIKE,REGEXP_INSTR,REGEXP_SUBSTR,REGEXP_REPLACE

时间:2017-11-07 17:37:06      阅读:345      评论:0      收藏:0      [点我收藏+]
参考:
-- 创建表
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 ;

 

技术分享  技术分享  技术分享 技术分享 技术分享 技术分享
 

REGEXP_LIKE,REGEXP_INSTR,REGEXP_SUBSTR,REGEXP_REPLACE

原文:http://www.cnblogs.com/tonghaolang/p/7799508.html

踩
(0)
赞
(0)
   
举报
评论 一句话评论(0)
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!