Splitting Column with Regex Split

I’m currently trying split data again from a column and having a bit of trouble with the regex split node again. I understand the first part of the code might be ([0-9]{4}) , but having a bit of trouble with the text since it also contains - and &.

Current Data
1234 ABCD EECKD 123.4562.1234.2142.6378.000.0000 -30.00 30.00 0.00
5678 ABCDE - FGHIK 123.4562.0000.2411.0000.000.0000 0.00 -12,345.86 -10,412.86
3143 ABC - DEFKHDF 213.4562.0000.2445.0000.000.0000 12,345,678.90 227,074.03 13,453,598.77
2341 AB RE-CDEF - LEASE C 456.4562.0330.3144.6506.030.0000 -123,456.78 -62,624.71 -542,017.98
2314 ABCDE & ABCD - ABCD 324.4561.1234.5678.0000.000.0000 -219,013.37 -27,366.04 -246,379.41

Ideally

All the text would be split.

Hi @Aliciang78 and welcome to the KNIME community forum,

Try this regex pattern and let me know if it works fine:
([\d-.,]+) ([a-zA-Z &-]+) ([\d-.,]+) ([\d-.,]+) ([\d-.,]+) ([\d-.,]+)

:blush:

2 Likes

Unfortunately, it doesn’t seem to be working.

I’m not sure if I need to apply another rule-based filter to only get the rows that start with 4 digits. If so, what node would you recommend?

But it seems it’s working on your examples for me:

regex_split.knwf (11.8 KB)

:blush:

2 Likes

Thanks for showing me how it works.

I think the reason why it’s not working with my current data is that the number of spaces in between the first 5 sets of data all vary.

For some reason when I paste my data into the table it doesn’t seem to be working.

regex_split.knwf (6.8 KB)

([\d-.,]+)\s+([a-zA-Z &-]+)\s+([\d-.,]+)\s+([\d-.,]+)\s+([\d-.,]+)\s+([\d-.,]+)

3 Likes

Thanks! That worked! :smile: Thank you both for all your help!

2 Likes

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