regex - Extract a specific word from string in PostgreSQL -
i using pgadmin version 1.16.1 , need extract words 'login' , 'logout' result column
url "http:/login-v1.abcd.com/service/abc/integration" "http:/xxxxxxxxlogout" "https:/login-v1.abcd.com/service"
result
url action "http:/login-v1.abcd.com/service/abc/integration" login "http:/xxxxxxxxlogout" logout "https:/login-v1.abcd.com/service" login
how can this?
use substring()
regular expression:
with t(txt) (values ('http:/login-v1.abcd.com/service/abc/integration') ,('http:/xxxxxxxxlogout') ,('https:/login-v1.abcd.com/service') ) select txt, substring(txt '(login|logout)') action t
Comments
Post a Comment