0

I am trying to remove the double-quoted in column values. for that, I am using regex_expression and replace but it doesn't remove the double-quoted can anyone please help me on this

I have value like this

"XYZ.COM "

I need to replace the above as

XYZ.COM

I tried this

regexp_replace(domain), '[^\w]+^.','','g')
replace(domain,'"','')

Note : I don't want to remove the dot from the string

3
  • 2
    replace(domain,'"','') should do exactly that. Commented Apr 22, 2020 at 5:59
  • I tried that also but getting the same quoted... Commented Apr 22, 2020 at 6:01
  • Then show us the complete code you are using because that will definitely work. See here: dbfiddle.uk/… Commented Apr 22, 2020 at 6:06

2 Answers 2

1

From the comments I guess that you are not really dealing with regular double quotes but with other characters (the so-called “curly quotes”).

So give the following a try:

replace(domain, E'"\u201C\u201D\u201E', '')
Sign up to request clarification or add additional context in comments.

Comments

0

you can use trim function with extra parameter.

postgres=# select trim(' "' from '"XYZ.COM "');
┌─────────┐
│  btrim  │
╞═════════╡
│ XYZ.COM │
└─────────┘
(1 row)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.