1
votes

I am trying the below query .

however it still not removing the character .

select regexp_replace(name ,'[][!#$%&()*+,.\/:;<=>?@\^_`{|}~-]+|(")+|(\')','') from name
1
What characters are not removed? Please share your sample data and expected output!Eric Lin

1 Answers

0
votes

To pass an apostrophe (') in the parameter, you have to double it (''), it should work like this:

select regexp_replace(name ,'[][!#$%&()*+,./:;<=>?@^_`{|}~-]+|(")+|('')','') from name;

Here is another example to remove anything that is not an expression and sign of separation:

select regexp_replace(name ,'[^[:word:][:blank:]]','') from name;

if underscore bothers you, you can try this:

select regexp_replace($name ,'[^[:alpha:][:blank:]]','') from name;

I use POSIX syntax, more about this read here: POSIX basic and extended