Struggling to split cell

Hi All,

Thanks in advance,

Struggling to split this cell into its components.

[ 413 0 6494]

Want it to be split into 3 columns:

[413], [0], [6494]

Tried the cell splitter node with no success, probably not using it right. See attached workflow.

Thank you,
Yush

KNIME_project4.knwf (6.2 KB)

Hi @Yush,

assuming you always have the same amount of numbers in your input, a regex split would help:

([0-9]*) ([0-9]*) (.*)

would do the job.

I have published a short quicktip video here:

You can also find the workflow (also using the amazing Palladian extension for testing) at the KNIME hub here:

Let us know, if this helped :slight_smile:

2 Likes

Hello @Yush,

seems space you have between numbers is some kind of weird space cause removeChars() doesn’t not remove it. Have you copy pasted this data from somewhere? Cell Splitter works as expected if I manually input data into Table Creator node.

Br,
Ivan

1 Like

Hello again @Yush,

seems that is non-breaking space character. How did you get it into KNIME?

Br,
Ivan

1 Like

Hi,

Sorry for the late reply. I’ve been struggling to get a connection to KNIME forums in recent days. I found this in an Excel file which I imported directly into KNIME. I believe the data in the Excel file was copied from a webpage. Is there any way to deal with this strange non-breaking character in KNIME?

Thanks,
Yush

Hello @Yush,

yes there is. You can use regexReplace() function from String Manipulation node with following expression to set up you column for Cell Splitter node based on regular space character:
strip( regexReplace( $column1$, "\\u00a0", " ") )

Note: strip() function is only need to remove leading space (and possibly trailing one) after replacement is done.

Also String Replacer node can be used for these tasks. See this topic:

Br,
Ivan

1 Like

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