regexp_replace字符串替换函数
profile的值:
-- {"nickname":小王,"avatarurl":"","gender":"0","city":"","province":"","country":""}
select regexp_replace (profile,'({"nickname":)(.*?)(,)','$1null$3')
from csig_th_datacenter_yidian_dw::dws_user_alluser_d where profile<>'';
结果:{"nickname":null,"avatarurl":"","gender":"0","city":"","province":"","country":""}
select regexp_replace (profile,'({"nickname":)(.*)(,)','$1null$3')
from csig_th_datacenter_yidian_dw::dws_user_alluser_d where profile<>'';
结果{"nickname":null,"country":""}