我正在使用pgadmin版本1.16.1,我需要提取“登录”字样。并且'退出'从 结果列
url
"http:/login-v1.abcd.com/service/abc/integration"
"http:/xxxxxxxxlogout"
"https:/login-v1.abcd.com/service"
结果
url Action
"http:/login-v1.abcd.com/service/abc/integration" login
"http:/xxxxxxxxlogout" logout
"https:/login-v1.abcd.com/service" login
我该怎么做?
答案 0 :(得分:3)
将substring()
与正则表达式一起使用:
WITH t(txt) AS (VALUES
('http:/login-v1.abcd.com/service/abc/integration')
,('http:/xxxxxxxxlogout')
,('https:/login-v1.abcd.com/service')
)
SELECT txt, substring(txt FROM '(login|logout)') AS action FROM t