截取特定符号间的数据,急!

zylkiki 2012-10-29 11:47:04
对邮箱数据进行提取:例如:123456@sina.com.cn,56789@163.com,123456.11@hotmail.com现在要提'@'和@之后第一个'.'之间的数据,结果应为sina、163、hotmail,请问如何截取?
谢谢。
...全文
235 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
888888888888 2012-10-29
  • 打赏
  • 举报
回复
是滴!
zylkiki 2012-10-29
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 的回复:]

SQL code
select regexp_replace(
regexp_substr('123456@sina.com.cn', '@[^.]+\.'),
'[@.]',
'') from dual;
[/Quote]
多谢
那么如果截取的是'@'和最后一个'.'之间的数据呢,例如123456@vip.sina.com.cn,截取的是vip.sina.com?
zylkiki 2012-10-29
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 的回复:]

SQL code

select ltrim(regexp_substr('123456@sina.com.cn','@[^.]+',1,1),'@') a from dual
[/Quote]

多谢
fw0124 2012-10-29
  • 打赏
  • 举报
回复
 select regexp_replace(
regexp_substr('123456@sina.com.cn', '@[^.]+\.'),
'[@.]',
'') from dual;
forgetsam 2012-10-29
  • 打赏
  • 举报
回复

select ltrim(regexp_substr('123456@sina.com.cn','@[^.]+',1,1),'@') a from dual
Pingszi 2012-10-29
  • 打赏
  • 举报
回复

select substr('123456@sina.com.cn',1,instr('123456@sina.com.cn','@') - 1) from dual

1 123456

17,377

社区成员

发帖
与我相关
我的任务
社区描述
Oracle 基础和管理
社区管理员
  • 基础和管理社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧