Skip to main content
Solved

How Can I match on an ASCII Control Character inside the StringReplacer?

  • June 28, 2017
  • 1 reply
  • 128 views

fmelizard
Contributor
Forum|alt.badge.img+17

I have an attribute that contains a string with ASCII control characters in it. I'd like to use the StringReplacer to either remove or replace those characters with something else. I see that I can select some characters (like the backspace character or the carriage return) from the Special Characters list inside FME's text editor, but the one I need isn't listed there. For example, the SOH (or start of heading) character is present in my data, but I can't match on it directly. What can I do to handle this?

Best answer by laurawatsafe

Great question! You can match on those types of characters by making use of the Match Regular Expression mode inside the StringReplacer. What you'll then need to do is look up the 2-digit hex code for the character you want to match on and use the following syntax inside the Text to Replace value: \\x<twoDigitCode>.

 

 

For example, if you want to match on the SOH character, you would need to set the Text to Replace to this: \\x01
View original
Did this help you find an answer to your question?

1 reply

laurawatsafe
Safer
Forum|alt.badge.img+11
  • Safer
  • Best Answer
  • June 28, 2017

Great question! You can match on those types of characters by making use of the Match Regular Expression mode inside the StringReplacer. What you'll then need to do is look up the 2-digit hex code for the character you want to match on and use the following syntax inside the Text to Replace value: \\x<twoDigitCode>.

 

 

For example, if you want to match on the SOH character, you would need to set the Text to Replace to this: \\x01

Reply


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