Replace Heater, substituting parts of a string
The Replace Heater allows you to substitute individual characters or substrings with an alternative character or sequences of characters.
Find: The character or substring to search for in the input
Replace: The character or substring that will replace the FIND character/substring pattern at the same position in the input string, if it is found.
Note: As of version 2.0.5 you can additionally choose special search/replace characters using the following predefined templates:
- <TAB> = Tabulator
- <SPACE> = Blank space
- <NEWLINE> = End paragraph (CRLF, or 0x0d0a).
Ignore case: If this option is checked then the case of the FIND string is ignored
Only first match: This option tells FlowHeater to replace only the first instance of the FIND character/substring. Tip: If you want to replace only the last occurrence of a single character, this can be achieved by arranging a series of Heaters in this combination: Reverse - Replace (first) – Reverse. Note that if your replacement string is more than one character it is necessary to spell it backwards if you use this trick.
Only match whole string: When this option is checked the Replace Heater compares whether the entire search value matches the input completely. If so, the string is entirely replaced and substring substitution is not relevant.
Overwrite entire string: If this option is checked, the input string is completely replaced whenever the search value matches all or part of the string. In this case, other parts of the input are effectively lost.
Default when not found: When the search value does not match, this defines a value to result instead of the original string. The default is to pass on the unaltered original value (<INPUTVALUE>).
If you have a table of substitutions to apply, you can define a list of values in the extended settings. There are two optional ways to achieve this:
- Substitutions list as a file: This lets you to browse to and select a CSV file that defines a parallel list of substring values to search for and replace. Note: The (CSV) file is reloaded for each execution.
So that special characters like umlauted or accented characters are properly processed, you must define here a Codepage that matches the CSV file format.
- Substitute from an internal list: This allows you to compose a parallel list that is saved as a part of the Definition data. You can enter the pairs of substitution values here by hand or using copy and paste.
The lists are composed in the general CSV style: match value, separator, substitute value
The following options let the Replace Heater know which (CSV) separator character divides the value pairs and which (CSV) columns contain the match and replace values.
Separator: The character that divides the CSV columns from one another. The default is the list separator configured in the operating system control panel.
Find column: Defines which column in the (CSV) list contains the (sub)string to search for. Default = 1 = the first column of the CSV file.
Replace column: Defines which column in the (CSV) list contains the (sub)string to be replaced when the search (sub)string matches. Default = 2 = the second column of the CSV file.
Terminate list processing after first match: When this option is checked, the rest of the list is ignored as soon as one matching (sub)string is found.
Note: The substitution list options can be used in combination with the normal single pair options.