0

I have multiple string where i want to split my string after first slash if it matches to specific pattern. But I am not finding way for it. I am using postgresql.

Split_column
PA067
PA089/GHC
PA001/FDCJ/988S

After PA---, there xan be 0 to n slashes. Now I am using,

case when  split_column ilike '%PA%' then split_part(split_column, '/', 2)

But here I need all, irrespective of position like For PA001/FDCJ/988S --> FDCJ/988S

Hambone
  • 15,600
  • 8
  • 46
  • 69

1 Answers1

1

Would position work?

substring (split_column , position ('/' in split_column ) + 1)

This just says take the string immediately after the first occurrence of '/'.

Hambone
  • 15,600
  • 8
  • 46
  • 69