Substring from an escape character onwards

287 Views Asked by At

I'm using PostgreSQL and I need to truncate a text string, I need to show from an escape character (:) onwards.

I'm trying something like that:

  SELECT SUBSTRING ('CATEGORIA DE TRABAJOS: EJECUTIVO' FROM '%#":#"%' FOR '#'); 
1

There are 1 best solutions below

1
On BEST ANSWER
t=# select split_part('CATEGORIA DE TRABAJOS: EJECUTIVO',':',2);
 split_part
------------
  EJECUTIVO
(1 row)

just split by first found delimiter?..