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?


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 

View original
Did this help you find an answer to your question?

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+35
  • 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
virtualcitymatt wrote:

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!


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings