sqlamazon-redshiftnon-printing-characters

Redshift: How to remove non-printable characters


I'm trying to remove non-printable characters from a string in Redshift and tried the TRANSLATE function but didn't return the results I'm looking for. Any advice?


Solution

  • Not quite right, this works:

    regexp_replace(<col>, '[^[:alnum:][:blank:][:punct:]]', '')
    

    It's a positive filter that will only allow ASCII, letters, numbers, spaces and punctuation.