Skip to main content
Solved

I have a column that contains a lot of special characters. By using transformer 'StringReplacer', I can replace i.e. an '#' by an ' '; How can I replace a list of special characters of 10 or more characters. Do I need to use 10 StringReplacers?

  • November 29, 2023
  • 5 replies
  • 148 views

I have a column that contains a lot of special characters. By using transformer 'StringReplacer', I can replace i.e. an '#' by an ' '; How can I replace a list of special characters of 10 or more characters. Do I need to use 10 StringReplacers?

Best answer by virtualcitymatt

Another optoin is to use a reular expression - this one should work:

!|"|§|\$|%|/|\(|\)|\=|\?|\\|\*|\+|'|#

The "|" charachter in a reqular expression is like a logical OR. You need to use "\" to escape some of the charachters.

imageimage 

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

5 replies

dustin
Influencer
Forum|alt.badge.img+31
  • Influencer
  • November 29, 2023

How is the column with the special characters structured? Space delimited? Comma delimited?


  • Author
  • November 29, 2023

I read the column from a database. All characters used are readable. Every record in this column is varchar(100). I need to change most of the special characters by ' '; my special character list that need to be replaced are: !"§$%/()=?\\*+'# but not &-


david_r
Celebrity
  • November 29, 2023

Did you look at the StringPairReplacer? Note that you must use <backslash>+<space> to indicate that you want to replace something with a <space>, as explained in the documentation. Example to replace # and ! with a space:

# \  ! \ 

 


virtualcitymatt
Celebrity
Forum|alt.badge.img+47
  • Celebrity
  • Best Answer
  • November 29, 2023

Another optoin is to use a reular expression - this one should work:

!|"|§|\$|%|/|\(|\)|\=|\?|\\|\*|\+|'|#

The "|" charachter in a reqular expression is like a logical OR. You need to use "\" to escape some of the charachters.

imageimage 


  • Author
  • November 29, 2023

Another optoin is to use a reular expression - this one should work:

!|"|§|\$|%|/|\(|\)|\=|\?|\\|\*|\+|'|#

The "|" charachter in a reqular expression is like a logical OR. You need to use "\" to escape some of the charachters.

imageimage 

Excellent!