Oracle正则表达式之匹配邮箱

本文介绍了一种使用正则表达式来筛选有效电子邮件地址的方法。通过创建包含多种格式电子邮箱的测试表,并应用特定的正则表达式进行匹配,有效地过滤出合法的邮箱地址。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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

--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

转载于:https://www.cnblogs.com/88893636-xuyang/p/6818672.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值