This is a modified version of the original Edit Path Variable Filename which, because of a KNIME bug could not operate inside a conditional branch within KNIME. This version differs only in that the returned path variable name is always given the prefix "path_" and therefore cannot replace an existing path variable.
Allows on-the-fly "editing" of an input path and file name using string concatenation (additon of simple prefix or suffix to a filename) or replacement of filename using regex, and direct replacement of filename extension.
Also allows the folder path to be modified using regex replacement.
Where regex is used, it follows the regex required by the String Manipulation regexReplace function, so any use of a \ within a folder path must be entered as double-backslash \\ so that regex does not misinterpret the character.
Example replacement that could be performed:
For an incoming file path representing
c:\myoutputfolders\excel\somefile.xlsx
Setting:
prefix: accounts-
suffix: -formatted
regex file search: (.*)file
regex file replace $1sheet
regex folder search: (.*)\\myoutputfolders\\(.*)
regex folder replace: $1\\formattedoutputs\\$2
would result in the output file:
c:\formattedoutputs\excel\accounts-somesheet-formatted.xlsx
@takbb Brian Bates 28 October 2023
- Type: Flow Variable