Extracting a Number with a forward slash to a new column

I am very new to knime.
I have been working a workflow and I am stuck trying to extract a number from text.

The problem is in a particular column, I have text but in front of the text is always a date written in the form dd/mm.
E.g “24/04 Testing my Knime workflow”. The date however can be written in any form in situations where the day or month is singular i.e. “3/3” or “09/3” or “9/03”.

I want to extract this number - in the case of my example “23/03” into a new column by itself.

Now I am not really interested in the string. I Just want a function that reads that column and extracts the number in front of the string into a new column.

Please can anyone offer any help as regards this?
Thank you.

Hi @Oladipo_O,

using a String Manipulation Node in combination with the regexReplace function should do the job. Here is the example workflow with two approaches both using RegEx.


1 Like

Thanks a lot @mwiegand, this looks like it will get the job done- for my initial question.
But I just found out of another instance of another possible format that the comments in the column could come in and I am not sure if this will fit that use.

So basically, there are some times when there will be updates to the case and that is sometimes captured in the column.
For example
the initial comment was “24/04 Testing my knime workflow”
there are instances where the comment will be “25/04 follow up on the test, 24/04 Testing my Knime workflow”

Now the date I am truly interested in is the first date that appears in the comment section i.e. in this instance the “25/04”

So my question is, is there a way to go about that in the instance where there are multiple dates in the comment?

The second solution in the workflow can cope with that scenario well:

1 Like

Ahhh great
let me try that and get back to you.
Thank you

Can you please explain how you wrote the command :grimacing::grimacing:

Hi @Oladipo_O

An other option is to use the Cell Splitter node. Where your delimiter is a whitespace, and the “Set array size” option = 2.

This gives you


gr. Hans


@Oladipo_O a great starting point learning RegEx is:

Though, bare in mind that Knime required double escaped backslashes “\s” representing white space.

regexReplace($column1$, "^([^\\s]+) .*", "$1")


Thanks for this
This works

1 Like

Thanks for the tip.
The solutions works :smiling_face::smiling_face:.

1 Like

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