正则表达式获取字符串内容

来源:互联网 发布:win7隐藏网络连接 编辑:程序博客网 时间:2024/05/22 17:11
将文本内容以key value的形式输出
name                                                fdafa
age                                                 28
provice                                             guangdong
tel                                                 13458545454

with tablea as
(select 'name:fdafa;age:28;provice:guangdong;tel:13458545454' name
from dual)
select substr(cname, 1, instr(cname, ':') - 1) key,
substr(cname, instr(cname, ':') + 1) value
from (select regexp_substr(a.name, '[^;]+', 1, level) cname
from tablea a
connect by level <
length(a.name) - length(replace(a.name, ':', '')) + 1);
原创粉丝点击