0

I have a procedure that is actually making a replace of '#$#' by '', the value that contains '#$#' it could be, like this one: 'AAA#$#DEFAEFGAA', with no defined length.

But what is really needed is to take only the characters after #$#, 'DEFAEFGAA'.

Thanks a lot in advance to those who take the time to read and trying to help me. Regards

I have tried to use replace regexp_replace to replace whatever is found from the beginning until the second '#' by '' but I can't find the right combination of commands like "(?=[^ ][a-z])(?=[^ ][0-9])[^ ]+'"

and I am also trying to use regexp_substr to take only the characters after #$# in case they appear or not.

JIT
  • 1
  • 1

1 Answers1

0

You can use charindex and substring instead of rexeg

with temp as (select 'AAA#$#DEFAEFGAA'::text as str)
select substring(str, charindex('#$#', str) + 3) as substr
from temp;

return 'DEFAEFGAA'

Lex Looter
  • 106
  • 5