2

I have a dataset containing special characters ' and ". I want to replace them with nothing. I tried to replace them with the replace function but it shows some error. Is there any other expression to replace these characters?

enter image description here

2 Answers 2

8

you can use this expression:

replace(replace("fieldname", char(34), ''), char(39), '')

char(34) corresponds to the double quote "

char(39) corresponds to the simple quote '

2
6

Use regular expressions with regex_replace() function. The single quote ' has to be masked by a backslash: \'. Use this expression to get rid of single ' and double quotes ":

regexp_replace (Dataset, '(\')|(")', '')

To also replace backslashes \, you must mask them with additional backslashes: \\\\:

regexp_replace (Dataset, '(\')|(")|(\\\\)', '')

With the or operator | you can add as many additional characters to delete as you want. Put the character to be replaced in brackets () .

enter image description here

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.