String replace (Dictionary) problem

Hi,

I am wondering why String replace (Dictionary) is not working with attached example!

The example text is following:
D:\Download\Test\BAADER BANK reported that XYZ - (Abcc) - 2020-06-04 1958.eml

and I would like to have only
Column1 Column2 Date
BAADER BANK XYZ 2020-06-04 1958

I also tried with encoding the slashes (e.g: D%3A%5CDownload%5CTest)

Test.knwf (10.0 KB)
Dictionary_StringRemoval.txt (42 Bytes)

Best,
Mateen

Hi Mateen,

The cell is compared against the keys in the dictionary file and - given that a matching key is found - the cell content is then replaced by the value of the respective dictionary entry.

AFAIK, the String Replace (Dictionary) compares the complete cell content and replaces it. It does not look out for partial matches. That said, it behaves different to its potential counterpart String Replacer that allows to define wildcard patterns and regular expressions.

I am not aware of a node that directly reads from a dictionary file and replaces partial matches in a cell.

I see a couple of potential workarounds:

  1. Manually create a regular expression based on your replacement rules (provided as file) and use it once in the String Replacer.

  2. Use a combination of String Replacer in combination with looping nodes (to apply each rule individually) – you probably need Table Row To Variable Loop Start/Loop End for applying multiple patterns in a loop and Recursive Loop Start/Recursive Loop End for passing the same string over and over again.

Maybe one of our more knowledgable forum users has an already working solution available or a way to solve this with even less nodes.

Best regards,
Daniel

2 Likes

Hello there!

isn’t this a job for Regex Split node?

Br,
Ivan

1 Like

Yeah. That took me also by surprise :slightly_smiling_face:

Hi @mateenraj,

not sure I follow. Check node description and examples in it to see how Regex Split works.

Br,
Ivan