'replace backslash in redshift

I am working with a string column in redshift database where the instance of \" occurs multiple times in the same value. I want to replace every occurrence of \" with "

For example, if a string = \"name\"

I want the output to be string = "name"

From what I have found, redshift does not allow the existence of a single backslash, and automatically converts it to a double backslash, but that is not happening in this case.

I have tried to use the REPLACE() with REPLACE( string, '\"', '"' ) but it did not have any effect. Can the string being a JSON string have any bearing on the function of REPLACE()?

I have been trying to use regexp_replace but maybe I am not using the right regular expression, hence I am not able to solve the problem.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source