String manipulation syntax

Hello guys,
I would like to kindly ask for a syntax in String manipulation Node.

I have this form of time periods:
W50 19
W52 19
W01 20
And I need to transform in this:
from W50 19 to 201950
from W52 23 to 202352
from W07 21 to 202107
where W50 or W07 is a week and 23 or 19 is a year always
so the final form is 201950
could you please help me with syntax?? many thanks in advance!!

Hi @Averin7777,

please check this example workflow:

Best
Mike

1 Like

Thank you so much for reply, but I do not know how to download the flow from your post? :man_facepalming:

You are welcome. Open Knime, navigate in your browser to the workflow in the hub, then drag & drop the icon in to top right into Knime

Otherwise, download the workflow and double click to open it. You still got to import / save it into your workspace, though :wink:

1 Like

thanks a lot I downloaded and the result ist like this
image
:smiley: not bad,
but iI need from W09 19 to 201909 I used this syntax
join(“20”, $ColumnNames$, (regexReplace($ColumnNames$, “[^\d]”, “”)))
not good in Join string so far

I can’t quite follow what you aim for. Or did you got it sorted with my example?

I can get the result with 5 string manipulation Nodes like this


Just looking for if any shorter solution with some syntax is available?
I used your syntax a the result was as I posted above, but not sure if I used it right way

Now I got you. The sample data provided wasn’t well structured so I thought the space was a column separator. So, as pretty much always, RegEx to the Rescue :wink:

I updated the workflows in the Hub as well.

2 Likes

thanks a lot for this “simple” syntax in one Node :clap: :+1: :v: one day I will be like you, maybe :innocent:

You are most welcome and feel rest assured, every “adventure” starts with taking the first step :wink: If I can you give one advice, make struggle your motivation and always remember, RegEx is your friend.

I’d appreciate if you’d mark my post as the solution and in case you feel comfortable supporting me too, I’d appreciate if you buy me a coffee (no obligation!):