Replace Heater, substituting parts of a string
Replace repeatedly until no longer found: If this option is checked it will replace recursively until the search string is no longer found. For example, this makes replacing a series of blank spaces with a single space very easy.
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.
The Replace Heater allows you to substitute individual characters or substrings with an alternative character or sequences of characters. The String Replace Heater allows you to strip any HTML tags found in a string simply and easily, and it is also possible to carry out “CSV Lookups” using the extended settings and so perform substitutions defined in external data.
Parameters
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: For search/replace strings, instead of manual entry you can choose the following preconfigured template characters.
- <TAB> = Tabulator
- <SPACE> = Blank space
- <NEWLINE> = End paragraph (CRLF, or 0x0d0a).
- <HTML Tags> = extract HTML tags found in the string (an option only for search strings)
Ignore case: If this option is checked then the case of the FIND string is ignored.
Begins with: When this option is checked, only the start of the string will be searched for the string to be replaced.
Ends with: If this option is enabled, only the last part of the string will be searched for the string to be replaced.
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.
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>).
Extended settings
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
e.g.
1;one
2;two
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.
InMemory Tables Replace
InMemory Adapter Tables Replace feature makes extremely fast CSV Lookups of individual values possible. The CSV text file must be read in during a preliminary processing step and saved in an InMemory table. It can then be accessed using these settings.
TheTable name: Select one of the InMemory tables available.
Search field: Select a field to search its content.
Replace field: Select the field that contains the field content to be replaced.
Terminate searching when first match found: When this option is checked, processing of the InMemory table ends when the first hit is encountered.
Please also refer to the general information on the use of Heaters (functions)