码迷,mamicode.com
首页 > 数据库 > 详细

Oracle正则表达式之匹配网址

时间:2017-05-06 22:55:29      阅读:272      评论:0      收藏:0      [点我收藏+]

标签:bsp   into   das   --   select   reg   values   int   insert   

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

--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正则表达式之匹配网址

标签:bsp   into   das   --   select   reg   values   int   insert   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!