首页 > 数据库技术 > 详细

Oracle正则表达式之匹配网址

时间:2017-05-06 22:32:46      阅读:236      评论:0      收藏:0      [点我收藏+]

利于正则表达式匹配出网址

--1 表准备
create table test_regexp
(
object varchar2(50)
);

--2 数据准备

insert into test_regexp (OBJECT)
values (‘http://www.baidu.com‘);

insert into test_regexp (OBJECT)
values (‘http://360.cn‘);

insert into test_regexp (OBJECT)
values (‘https://help.alipay.com‘);

insert into test_regexp (OBJECT)
values (‘cctv.cn‘);

insert into test_regexp (OBJECT)
values (‘www.cntv.com‘);

insert into test_regexp (OBJECT)
values (‘23212.sasdas.2222‘);

commit;

--3 

select * from test_regexp where   regexp_like(object,‘^(https?://)?(\w+\.)+[a-zA-Z]+$‘) ;

--4 返回结果

http://www.baidu.com
http://360.cn
https://help.alipay.com
cctv.cn
www.cntv.com
23212.sasdas.2222

Oracle正则表达式之匹配网址

原文:http://www.cnblogs.com/88893636-xuyang/p/6818756.html

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