Solved

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

  • 29 June 2017
  • 1 reply
  • 30 views

Userlevel 4
Badge +13

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?

icon

Best answer by lauraatsafe 29 June 2017, 00:16

View original

1 reply

Badge +9

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