Column split (?) Regex

I have a string:

[ Degree:{ } School:{ St.Petersburg University } Field:{ Oriental studies } Session:{ 2009 - 2009} ][ Degree:{ GCP } School:{ Columbia Business School } Field:{ Global Account Management } Session:{ 2009 - 2009} ][ Degree:{ Diploma } School:{ INSEAD } Field:{ Business Administration } Session:{ 1997 - 2007} ][ Degree:{ } School:{ IMD - Business Programs } Field:{ } Session:{ 2010 - 2011} ]

I’d’ like to make it a table with columns:

Degree School Fileld Session
No data St.P Oriental studies 2009-2009

I do understand that regex should handle this easily, but I failed to write correct regex expression. Please help me with this task - I relly tried hard to solve it myself.

Thank you very much and have a nice weekend!

Hi @DmitryIvanov76

I don’t know much about regex and since this is a KNIME forum. I found a solution without using regex.
See column_split.knwf (74.8 KB) .
And yes you need some nodes, but it works :slight_smile:


gr. Hans

7 Likes

Dear Hans.
Thank you very much! Your solution works indeed!

2 Likes

The cell splitter on ][ that @HansS suggested was key to breaking this up into the “records”. If you cell split with the “as list” option, you can then ungroup into rows. After that, if you want to use a regex, it can be applied to find the fields between { } marks.

As always, many ways to do it and it comes down to whatever way you find easier and works for you!

A quote I saw recently, that I cannot remember who said it, but it is so true… something along the lines of "You decide that regex is the answer to your problem… and then you have two problems… :wink: "

KNIME_column_split.knwf (13.4 KB)

6 Likes

What a great quote and absolutely outstanding solution!
Thank you!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.