Extract table from text file (regex in multi lines)

I want to extract a table containing only names, surnames and emails from a text file, which are written in exactly the same way in consecutive lines, and the rest of the lines remain in a separate table. how can I use string manipulation node with regex within multi lines and check row ids difference.
data.txt (645 Bytes)
data:
data
table1:
result1
table2:
result2

Hello @amindior,

and welcome to KNIME Community!

You don’t need regex for this (and not sure how one can help here unless for filtering).

Anyways you can try following approach:

  • first separate Name, Lastname and Email rows from other data rows β†’ use Rule-based Row Splitter for this and function LIKE
  • then split Name, Lastname and Email rows into two columns using Cell Splitter node β†’ separator is :
  • use Pivoting node to get Name, Lastname and Email into column headers and values under it β†’ no grouping column, pivoting column is first column from Cell Splitter and on second column from Cell Splitter use List aggregation
  • finish it with Ungroup node

Hope this helps you get started!

Br,
Ivan

2 Likes

Hello @amindior,

You can design a workflow following the attached image for your reference.

Additionally, I have attached the workflow for your reference.

Extract table from text file (regex in multi lines).knwf (83.6 KB)

1 Like