平台正则使用

落花浮王杯 提交于 2019-11-30 21:24:55

 

 

-- select * from ods_eventID limit 10;

select 
    logmessage,
    -- regexp_extract(logmessage,'\\"Services\sType:ICALL\\"',0)  as serviceType
     regexp_extract(replace(logmessage,"\"",""),'Services Type:(.*?),',1)  as serviceType
from ods_eventID
limit 10;

-- 平台上查出来的字段:
-- "[{""POI Categories"":""-"",""POI Provider"":""NavInfo"",""POI Address"":{""Address"":""available"",""Latitude"":""available"",""Longitude"":""available""},""Additional Notes"":""-"",""POI Name"":""äž­å›œçŸ³åŒ–é¹ç«¹æºåŠ æ²¹ç«™""}]"
"{""Notes"":[""User: cleanupAdmin""],""Call Reason"":[""INVISIBLE_CLEANUP""],""Services Type"":""BCALL"",""Home Country"":""CN"",""Call Center"":""TSSB_CN"",""Event Duration"":3867,""Call ID"":""4D4837333433352509B09100@bmw.de""}"

select replace('"Services Type":"ICALL"',"T",111)

select replace(logmessage,"\"","")
from ods_eventID
limit 10;

select regexp_extract(replace("Services Type":"ICALL","Home Country":"CN","Call Center":"CU_ININ",",),'(Type)',0);


select regexp_extract('Services Type:ICALL,Home Country:CN,Call Center:CU_ININ','Services Type:(.*?),',1);

 

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!