Oracle正则表达式之匹配邮箱

时间:2023-03-09 02:15:44
Oracle正则表达式之匹配邮箱

利于正则表达式匹配出符合电子邮箱的数据

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

--2 数据准备

insert into test_regexp (OBJECT)
values ('kjrb@homeway.com.cn');

insert into test_regexp (OBJECT)
values ('tougao@ctaxnews.com.cn');

insert into test_regexp (OBJECT)
values ('musi.ca.1@public.net');

insert into test_regexp (OBJECT)
values ('jjrbtg@ced.com');

insert into test_regexp (OBJECT)
values ('zhaorig@ihw.com.cn');

insert into test_regexp (OBJECT)
values ('sasdasdsad');

insert into test_regexp (OBJECT)
values ('18235139360@163.com');

insert into test_regexp (OBJECT)
values ('w123@qq.com');

commit;

--3

select * from test_regexp where   regexp_like(object,'^\w+(\.\w+)*@\w+(\.\w+)+$')

--4 返回结果

kjrb@homeway.com.cn
tougao@ctaxnews.com.cn
musi.ca.1@public.net
jjrbtg@ced.com
zhaorig@ihw.com.cn
18235139360@163.com
w123@qq.com