Replace every other space

I’ve got a transformation that I can’t able to figure out.
What I want to do is replace every other space with a comma.

An example:
1234 1234 1234 1234 1234 1234
Should be
1234 1234, 1234 1234,1234 1234

I tried regex replace, but that’s not doing what I want.
(Maybe my expression is not working), Do you guys have a solution.

Ps the strings are realy long and the number are not always the same length.
Thanks in advance!

Split the values into rows, append a comma in every other row, then concatenate back.

See the example below:
reconcatenation.morph (4.3 KB)

Thanks this works. The only problem is that I have 1.5 million records. When I split them I have 204 million records. After that my machine doesnt respond anymore :wink: (easymoreph uses 27gb ram at that moment).

Do you have another option?
Otherwise I will split the data in 2 datasets.

Could it help if you process the table (with 1.5 million records) iteratively?

The example attached passes every line of the input data to a submodule (holding Dmitry’s flow) and catches its results, which are appended into a new column.

reconcatenation_in_loop.morph (6.3 KB)

1 Like

Hi David, thanks.
I managed to split my dataset in 3 sets and then it worked great.