# Convert a string to a list to extract the maximum

Hello,
I have a column of strings. The column has a string type.
Each string is as follow:
[[0.1,5,8,0.1],[0.1,55,0.1],[11,1,0.9]]
The string looks like a list of list and I would like to extract the maximum from a particular list.
Is there a script or node that can do the job?
Thanks,

Hi,

What do you mean by this?

Do you need to extract the max value from one of the lists inside the main list? Or the max value of all the numbers?

1 Like

Hi @armingrudd,
I would like to extract the max number from a particular list.
Ideally, I would like to convert this list of lists into a table where each list populates a column or a row.
Then it will be easy to extract the information that I need.

Would you provide an example of what you want as the output using several input instances?

1 Like

you can do that; question is what you want to do with it. I have built a workflow that extracts the maximum of 55 from your string. Maybe you can adapt that.

Also the string looks like some Python/numpy structure.

kn_example_split_string.knwf (13.0 KB)

3 Likes

Hi @armingrudd and @mlauber71 ,
The input is a string that looks like a matrix from Matlab (each list is a column from the matrix).
Originally, the list of list is like this:

For instance, the string starts with [[0, 0.05,0.80,1.55,2.83â€¦,1.52],[0.06,0,0.80,â€¦],[1.45,1.46,0,â€¦],â€¦]
We can say that we can separate the upper triangle from the lower triangle with the zero.
My goal is to find the maximum in the upper and the lower triangle of the matrix(ie above and under the diagonal).

Ideally, I would like to transform this list of lists into a table to find the maximum of the upper triangle 5.24 and the lower triangle 2.58.
Thanks,
Zied

1 Like

Here you are:

max.knwf (371.5 KB)

5 Likes

This is great, thanks @armingrudd
I think I need to upgrade to version Knime 4 before I can use your workflow.
I have Knime 3.7 and I have many extensions installed.
Is there a way to update my current version without the need to install Knime 4 from scratch?
Thanks,

3 Likes

Youâ€™re welcome.
You need to uninstall all the incompatible extensions before upgrading to KNIME AP 4.0.
In my experience it was easier to install the new version from scratch since I had all extensions installed.

1 Like

Hi @armingrudd,
I tested your workflow. I think it work well with positive number but once there are negative number it fails.
I think it is because you split the cell with â€ś-â€ť as a delimiter. This will break negative numbers into cells too.
I am not sure how I can get rid of this bug.

1 Like

You are right. Sorry for the mistake. I just edited the workflow and replaced the â€ś-â€ť with â€ś_â€ť.

1 Like

Yes. I have edited my previous post which contains the new workflow now.

1 Like

Hi @armingrudd,
It is me again and I am terribly sorry to ask for your help again.
My friend parsed the initial string with a completely different way so I got inspired from your workflow to build mine.
But I am still struggling to make it work properly.
It is again searching for the maximum in the lower triangle.
Some nodes are not working as I want them to do.
I attached my workflow here.

RMSD-max.knwf (36.0 KB)

1 Like

If you use â€śexactlyâ€ť the same workflow as mine and replace the expression inside the String Manipulation node with the one below and change the delimiter in the second Cell Splitter node from â€ś,â€ť to " " (space), it will work fine:

`regexReplace(regexReplace(\$column1\$, "[\\d]+:moetmp_1" ,""),"\\\\012", "_")`

Here is the workflow: EDITED: BASED ON THE ASSUMPTION THAT THE MATRIX IS A SQUARE AND THE DIAGONAL IS REPRESENTED BY ZERO VALUES
RMSD-max.knwf (123.7 KB)

3 Likes

Hi @armingrudd,
The workflow worked for that particulat string but failed with this one:
1:moetmp_1 3.11 6.67 7.67 1.29 6.87 1.24 11.97 1.58 1.61 \012 2:moetmp_1 1.10 6.54 7.84 2.94 5.99 2.88 10.91 3.11 3.11 \012 3:moetmp_1 6.85 6.67 4.43 6.54 6.32 6.54 6.05 6.50 6.50 \012 4:moetmp_1 7.76 7.87 4.33 7.66 8.05 7.65 7.74 7.62 7.63 \012 5:moetmp_1 0.73 0.96 6.72 7.73 6.83 0.44 12.11 0.70 0.72 \012 6:moetmp_1 3.77 3.27 6.55 8.14 3.58 6.82 10.67 6.65 6.62 \012 7:moetmp_1 0.71 1.10 6.71 7.72 0.39 3.67 11.94 0.67 0.70 \012 8:moetmp_1 4.26 3.85 6.04 7.49 4.21 4.05 4.21 12.03 12.04 \012 9:moetmp_1 0.75 1.06 6.67 7.72 0.37 3.56 0.31 4.16 0.12 \012 10:moetmp_1 0.75 1.03 6.67 7.72 0.37 3.55 0.31 4.15 0.07 \012 11:moetmp_1 0.77 1.07 6.67 7.71 0.36 3.58 0.35 4.14 0.23 0.22 \012 12:moetmp_1 1.00 0.34 6.63 7.76 0.88 3.34 1.00 3.97 0.98 0.96 \012 13:moetmp_1 1.02 0.87 6.87 7.99 0.97 3.39 0.98 3.98 0.97 0.95 \012 14:moetmp_1 0.99 1.08 6.72 7.83 0.77 3.43 0.77 3.99 0.69 0.65 \012 15:moetmp_1 0.83 0.81 6.63 7.77 0.83 3.49 0.91 3.88 0.81 0.80 \012 16:moetmp_1 2.06 2.11 6.08 7.44 1.85 3.61 1.85 4.00 1.73 1.71 \012 17:moetmp_1 2.06 2.11 6.08 7.44 1.85 3.61 1.85 4.00 1.73 1.71 \012 18:moetmp_1 2.06 2.11 6.08 7.44 1.85 3.61 1.85 4.00 1.73 1.71 \012 19:moetmp_1 2.89 2.57 6.28 7.82 2.94 2.99 2.87 3.74 2.83 2.81 \012 20:moetmp_1 0.79 1.07 6.64 7.72 0.41 3.53 0.35 4.10 0.19 0.17 \012 21:moetmp_1 1.62 1.77 6.81 7.90 1.28 3.72 1.21 4.44 1.21 1.20 \012 22:moetmp_1 1.62 1.77 6.80 7.90 1.27 3.73 1.21 4.45 1.20 1.20 \012 23:moetmp_1 1.71 1.87 6.68 7.83 1.35 3.88 1.32 4.40 1.30 1.29 \012 24:moetmp_1 1.99 1.94 6.40 7.69 1.82 3.57 1.82 4.01 1.69 1.67 \012 25:moetmp_1 1.01 0.83 6.39 7.49 0.83 3.40 0.99 4.17 0.95 0.93 \012 26:moetmp_1 1.99 2.00 6.37 7.69 1.83 3.62 1.80 4.02 1.69 1.67 \012 27:moetmp_1 2.00 2.01 6.40 7.72 1.85 3.63 1.81 4.04 1.71 1.68 \012 28:moetmp_1 1.98 1.98 6.37 7.70 1.84 3.58 1.80 4.01 1.70 1.67 \012 29:moetmp_1 1.97 1.97 6.36 7.69 1.81 3.60 1.78 4.02 1.67 1.65 \012 30:moetmp_1 1.94 1.95 6.36 7.67 1.79 3.61 1.76 4.02 1.65 1.63 \012 31:moetmp_1 2.03 2.06 6.41 7.66 1.89 3.63 1.87 4.11 1.75 1.73 \012 1:moetmp_1 1.58 2.83 2.65 1.94 2.71 3.69 3.69 3.69 13.30 1.57 \012 2:moetmp_1 3.07 0.63 1.57 2.59 1.35 3.78 3.78 3.78 13.01 3.10 \012 3:moetmp_1 6.49 6.49 6.72 6.59 6.52 6.05 6.05 6.05 6.36 6.47 \012 4:moetmp_1 7.61 7.72 7.95 7.82 7.79 7.13 7.13 7.13 8.06 7.62 \012 5:moetmp_1 0.89 2.67 2.50 1.33 2.59 3.29 3.29 3.29 12.73 0.74 \012 6:moetmp_1 6.57 6.22 6.66 7.19 6.61 7.10 7.10 7.10 12.45 6.63 \012 7:moetmp_1 0.83 2.62 2.49 1.41 2.50 3.08 3.08 3.08 12.92 0.69 \012 8:moetmp_1 11.95 11.17 11.69 12.17 11.21 10.77 10.77 10.77 19.11 11.99 \012 9:moetmp_1 0.45 2.95 2.91 1.53 2.95 3.05 3.05 3.05 12.81 0.21 \012 10:moetmp_1 0.47 2.96 2.93 1.57 2.97 3.06 3.06 3.06 12.76 0.22 \012 11:moetmp_1 2.92 2.87 1.51 2.91 3.10 3.10 3.10 12.98 0.43 \012 12:moetmp_1 0.99 1.22 2.20 1.08 3.81 3.81 3.81 13.07 2.95 \012 13:moetmp_1 1.01 0.82 1.54 1.31 4.13 4.13 4.13 13.21 2.91 \012 14:moetmp_1 0.70 1.01 0.83 1.92 3.66 3.66 3.66 13.28 1.56 \012 15:moetmp_1 0.81 0.82 0.95 0.95 3.70 3.70 3.70 13.47 2.95 \012 16:moetmp_1 1.72 2.13 2.10 1.66 2.06 0.00 0.00 13.78 3.02 \012 17:moetmp_1 1.72 2.13 2.10 1.66 2.06 0.00 0.00 13.78 3.02 \012 18:moetmp_1 1.72 2.13 2.10 1.66 2.06 0.00 0.00 13.78 3.02 \012 19:moetmp_1 2.85 2.66 2.71 2.73 2.77 2.56 2.56 2.56 12.84 \012 20:moetmp_1 0.20 1.00 0.98 0.65 0.83 1.64 1.64 1.64 2.77 \012 21:moetmp_1 1.22 1.75 1.67 1.35 1.86 1.45 1.45 1.45 2.98 1.16 \012 22:moetmp_1 1.21 1.75 1.67 1.35 1.85 1.43 1.43 1.43 2.98 1.16 \012 23:moetmp_1 1.28 1.86 1.78 1.42 1.88 1.26 1.26 1.26 3.09 1.25 \012 24:moetmp_1 1.70 1.97 1.86 1.52 1.99 0.73 0.73 0.73 2.52 1.61 \012 25:moetmp_1 0.95 0.71 1.01 1.13 1.02 1.97 1.97 1.97 2.73 0.97 \012 26:moetmp_1 1.69 2.03 1.94 1.54 2.01 0.59 0.59 0.59 2.52 1.61 \012 27:moetmp_1 1.71 2.04 1.94 1.55 2.03 0.63 0.63 0.63 2.49 1.62 \012 28:moetmp_1 1.70 2.01 1.92 1.53 2.00 0.63 0.63 0.63 2.45 1.62 \012 29:moetmp_1 1.67 2.00 1.92 1.52 1.99 0.61 0.61 0.61 2.50 1.59 \012 30:moetmp_1 1.65 1.98 1.88 1.50 1.97 0.62 0.62 0.62 2.46 1.57 \012 31:moetmp_1 1.75 2.07 1.99 1.63 2.07 0.70 0.70 0.70 2.55 1.67 \012 1:moetmp_1 4.82 4.82 5.90 5.86 4.66 5.97 5.98 5.97 6.15 5.97 \012 2:moetmp_1 3.80 3.80 5.56 5.42 3.52 5.51 5.53 5.49 5.55 5.49 \012 3:moetmp_1 7.41 7.40 7.23 6.20 6.26 6.20 6.21 6.18 6.18 6.18 \012 4:moetmp_1 7.93 7.93 7.82 7.40 7.46 7.40 7.42 7.41 7.40 7.39 \012 5:moetmp_1 4.04 4.04 5.83 5.74 4.67 5.74 5.76 5.76 5.96 5.78 \012 6:moetmp_1 6.26 6.26 7.37 6.99 6.98 7.39 7.43 7.38 7.40 7.31 \012 7:moetmp_1 3.95 3.95 5.76 5.68 4.54 5.68 5.70 5.70 5.89 5.71 \012 8:moetmp_1 11.99 12.00 11.12 11.15 9.77 11.12 11.14 11.03 11.09 11.05 \012 9:moetmp_1 4.42 4.42 5.70 5.60 4.67 5.65 5.67 5.66 5.80 5.67 \012 10:moetmp_1 4.45 4.45 5.70 5.60 4.69 5.65 5.67 5.66 5.80 5.67 \012 11:moetmp_1 4.42 4.42 5.73 5.65 4.49 5.69 5.71 5.70 5.85 5.70 \012 12:moetmp_1 3.94 3.93 5.59 5.47 3.73 5.55 5.57 5.53 5.60 5.53 \012 13:moetmp_1 4.05 4.05 5.77 5.69 4.00 5.76 5.77 5.75 5.81 5.74 \012 14:moetmp_1 3.79 3.79 5.89 5.91 4.29 5.87 5.87 5.88 5.93 5.89 \012 15:moetmp_1 3.83 3.83 5.45 5.40 3.70 5.44 5.46 5.42 5.50 5.43 \012 16:moetmp_1 3.42 3.43 4.84 4.78 4.32 4.73 4.76 4.72 4.81 4.78 \012 17:moetmp_1 3.42 3.43 4.84 4.78 4.32 4.73 4.76 4.72 4.81 4.78 \012 18:moetmp_1 3.42 3.43 4.84 4.78 4.32 4.73 4.76 4.72 4.81 4.78 \012 19:moetmp_1 10.10 10.10 13.72 13.24 14.73 13.56 13.61 13.69 13.61 13.71 \012 20:moetmp_1 4.44 4.44 5.68 5.59 4.64 5.64 5.66 5.65 5.79 5.66 \012 21:moetmp_1 0.06 1.54 1.75 3.92 2.42 2.41 2.44 2.43 2.43 \012 22:moetmp_1 0.05 1.55 1.75 3.92 2.42 2.41 2.43 2.42 2.43 \012 23:moetmp_1 0.59 0.57 1.45 5.77 1.51 1.56 1.53 1.66 1.54 \012 24:moetmp_1 1.37 1.36 1.26 5.88 0.83 0.91 0.91 0.86 0.89 \012 25:moetmp_1 1.61 1.61 1.69 1.86 5.89 5.88 5.80 5.87 5.81 \012 26:moetmp_1 1.31 1.30 1.16 0.34 1.93 0.28 0.28 0.30 0.42 \012 27:moetmp_1 1.33 1.31 1.19 0.33 1.95 0.11 0.28 0.41 0.45 \012 28:moetmp_1 1.34 1.33 1.22 0.33 1.92 0.13 0.10 0.33 0.32 \012 29:moetmp_1 1.32 1.30 1.17 0.33 1.90 0.10 0.13 0.12 0.39 \012 30:moetmp_1 1.32 1.30 1.19 0.31 1.87 0.15 0.14 0.14 0.16 \012 31:moetmp_1 1.39 1.38 1.26 0.33 1.95 0.33 0.33 0.34 0.35 0.33 \012 1:moetmp_1 6.02 \012 2:moetmp_1 5.43 \012 3:moetmp_1 6.26 \012 4:moetmp_1 7.38 \012 5:moetmp_1 5.74 \012 6:moetmp_1 7.22 \012 7:moetmp_1 5.66 \012 8:moetmp_1 11.08 \012 9:moetmp_1 5.86 \012 10:moetmp_1 5.87 \012 11:moetmp_1 5.89 \012 12:moetmp_1 5.47 \012 13:moetmp_1 5.68 \012 14:moetmp_1 5.82 \012 15:moetmp_1 5.36 \012 16:moetmp_1 4.97 \012 17:moetmp_1 4.97 \012 18:moetmp_1 4.97 \012 19:moetmp_1 13.58 \012 20:moetmp_1 5.85 \012 21:moetmp_1 3.55 \012 22:moetmp_1 3.55 \012 23:moetmp_1 1.97 \012 24:moetmp_1 1.00 \012 25:moetmp_1 5.96 \012 26:moetmp_1 1.63 \012 27:moetmp_1 1.68 \012 28:moetmp_1 1.62 \012 29:moetmp_1 1.61 \012 30:moetmp_1 1.64 \012 31:moetmp_1 \012

I couldnâ€™t figure out what is wrong.
Thanks,
Zied

I think it is about how the string starts.

1:moetmp_1 3.11 6.67 7.67 1.29 6.87 1.24 11.97 1.58 1.61 \012 2:moetmp_1 1.10 6.54 7.84 2.94 5.99 2.88 10.91 3.11 3.11 \012 3:moetmp_1 6.85 6.67 4.43 6.54 6.32 6.54 6.05 6.50 6.50 \012 4:moetmp_1 7.76 7.87 4.33 7.66 8.05 7.65 7.74 7.62 7.63 \012 5:moetmp_1 0.73 0.96 6.72 7.73 6.83 0.44 12.11 0.70 0.72 \012 6:moetmp_1 3.77 3.27 6.55 8.14 3.58 6.82 10.67 6.65 6.62 \012 7:moetmp_1 0.71 1.10 6.71 7.72 0.39 3.67 11.94 0.67 0.70 \012 8:moetmp_1 4.26 3.85 6.04 7.49 4.21 4.05 4.21 12.03 12.04 \012 9:moetmp_1 0.75 1.06 6.67 7.72 0.37 3.56 0.31 4.16 0.12 \012 10:moetmp_1 0.75 1.03 6.67 7.72 0.37 3.55 0.31 4.15 0.07 \012 11:moetmp_1 0.77 1.07 6.67 7.71 0.36 3.58 0.35 4.14 0.23 0.22 \012 12:moetmp_1 1.00 0.34 6.63 7.76 0.88 3.34 1.00 3.97 0.98 0.96 \012 13:moetmp_1 1.02 0.87 6.87 7.99 0.97 3.39 0.98 3.98 0.97 0.95 \012 14:moetmp_1 0.99 1.08 6.72 7.83 0.77 3.43 0.77 3.99 0.69 0.65 \012 15:moetmp_1 0.83 0.81 6.63 7.77 0.83 3.49 0.91 3.88 0.81 0.80 \012 16:moetmp_1 2.06 2.11 6.08 7.44 1.85 3.61 1.85 4.00 1.73 1.71 \012 17:moetmp_1 2.06 2.11 6.08 7.44 1.85 3.61 1.85 4.00 1.73 1.71 \012 18:moetmp_1 2.06 2.11 6.08 7.44 1.85 3.61 1.85 4.00 1.73 1.71 \012 19:moetmp_1 2.89 2.57 6.28 7.82 2.94 2.99 2.87 3.74 2.83 2.81 \012 20:moetmp_1 0.79 1.07 6.64 7.72 0.41 3.53 0.35 4.10 0.19 0.17 \012 21:moetmp_1 1.62 1.77 6.81 7.90 1.28 3.72 1.21 4.44 1.21 1.20 \012 22:moetmp_1 1.62 1.77 6.80 7.90 1.27 3.73 1.21 4.45 1.20 1.20 \012 23:moetmp_1 1.71 1.87 6.68 7.83 1.35 3.88 1.32 4.40 1.30 1.29 \012 24:moetmp_1 1.99 1.94 6.40 7.69 1.82 3.57 1.82 4.01 1.69 1.67 \012 25:moetmp_1 1.01 0.83 6.39 7.49 0.83 3.40 0.99 4.17 0.95 0.93 \012 26:moetmp_1 1.99 2.00 6.37 7.69 1.83 3.62 1.80 4.02 1.69 1.67 \012 27:moetmp_1 2.00 2.01 6.40 7.72 1.85 3.63 1.81 4.04 1.71 1.68 \012 28:moetmp_1 1.98 1.98 6.37 7.70 1.84 3.58 1.80 4.01 1.70 1.67 \012 29:moetmp_1 1.97 1.97 6.36 7.69 1.81 3.60 1.78 4.02 1.67 1.65 \012 30:moetmp_1 1.94 1.95 6.36 7.67 1.79 3.61 1.76 4.02 1.65 1.63 \012 31:moetmp_1 2.03 2.06 6.41 7.66 1.89 3.63 1.87 4.11 1.75 1.73 \012 1:moetmp_1 1.58 2.83 2.65 1.94 2.71 3.69 3.69 3.69 13.30 1.57 \012 2:moetmp_1 3.07 0.63 1.57 2.59 1.35 3.78 3.78 3.78 13.01 3.10 \012 3:moetmp_1 6.49 6.49 6.72 6.59 6.52 6.05 6.05 6.05 6.36 6.47 \012 4:moetmp_1 7.61 7.72 7.95 7.82 7.79 7.13 7.13 7.13 8.06 7.62 \012 5:moetmp_1 0.89 2.67 2.50 1.33 2.59 3.29 3.29 3.29 12.73 0.74 \012 6:moetmp_1 6.57 6.22 6.66 7.19 6.61 7.10 7.10 7.10 12.45 6.63 \012 7:moetmp_1 0.83 2.62 2.49 1.41 2.50 3.08 3.08 3.08 12.92 0.69 \012 8:moetmp_1 11.95 11.17 11.69 12.17 11.21 10.77 10.77 10.77 19.11 11.99 \012 9:moetmp_1 0.45 2.95 2.91 1.53 2.95 3.05 3.05 3.05 12.81 0.21 \012 10:moetmp_1 0.47 2.96 2.93 1.57 2.97 3.06 3.06 3.06 12.76 0.22 \012 11:moetmp_1 2.92 2.87 1.51 2.91 3.10 3.10 3.10 12.98 0.43 \012 12:moetmp_1 0.99 1.22 2.20 1.08 3.81 3.81 3.81 13.07 2.95 \012 13:moetmp_1 1.01 0.82 1.54 1.31 4.13 4.13 4.13 13.21 2.91 \012 14:moetmp_1 0.70 1.01 0.83 1.92 3.66 3.66 3.66 13.28 1.56 \012 15:moetmp_1 0.81 0.82 0.95 0.95 3.70 3.70 3.70 13.47 2.95 \012 16:moetmp_1 1.72 2.13 2.10 1.66 2.06 0.00 0.00 13.78 3.02 \012 17:moetmp_1 1.72 2.13 2.10 1.66 2.06 0.00 0.00 13.78 3.02 \012 18:moetmp_1 1.72 2.13 2.10 1.66 2.06 0.00 0.00 13.78 3.02 \012 19:moetmp_1 2.85 2.66 2.71 2.73 2.77 2.56 2.56 2.56 12.84 \012 20:moetmp_1 0.20 1.00 0.98 0.65 0.83 1.64 1.64 1.64 2.77 \012 21:moetmp_1 1.22 1.75 1.67 1.35 1.86 1.45 1.45 1.45 2.98 1.16 \012 22:moetmp_1 1.21 1.75 1.67 1.35 1.85 1.43 1.43 1.43 2.98 1.16 \012 23:moetmp_1 1.28 1.86 1.78 1.42 1.88 1.26 1.26 1.26 3.09 1.25 \012 24:moetmp_1 1.70 1.97 1.86 1.52 1.99 0.73 0.73 0.73 2.52 1.61 \012 25:moetmp_1 0.95 0.71 1.01 1.13 1.02 1.97 1.97 1.97 2.73 0.97 \012 26:moetmp_1 1.69 2.03 1.94 1.54 2.01 0.59 0.59 0.59 2.52 1.61 \012 27:moetmp_1 1.71 2.04 1.94 1.55 2.03 0.63 0.63 0.63 2.49 1.62 \012 28:moetmp_1 1.70 2.01 1.92 1.53 2.00 0.63 0.63 0.63 2.45 1.62 \012 29:moetmp_1 1.67 2.00 1.92 1.52 1.99 0.61 0.61 0.61 2.50 1.59 \012 30:moetmp_1 1.65 1.98 1.88 1.50 1.97 0.62 0.62 0.62 2.46 1.57 \012 31:moetmp_1 1.75 2.07 1.99 1.63 2.07 0.70 0.70 0.70 2.55 1.67 \012 1:moetmp_1 4.82 4.82 5.90 5.86 4.66 5.97 5.98 5.97 6.15 5.97 \012 2:moetmp_1 3.80 3.80 5.56 5.42 3.52 5.51 5.53 5.49 5.55 5.49 \012 3:moetmp_1 7.41 7.40 7.23 6.20 6.26 6.20 6.21 6.18 6.18 6.18 \012 4:moetmp_1 7.93 7.93 7.82 7.40 7.46 7.40 7.42 7.41 7.40 7.39 \012 5:moetmp_1 4.04 4.04 5.83 5.74 4.67 5.74 5.76 5.76 5.96 5.78 \012 6:moetmp_1 6.26 6.26 7.37 6.99 6.98 7.39 7.43 7.38 7.40 7.31 \012 7:moetmp_1 3.95 3.95 5.76 5.68 4.54 5.68 5.70 5.70 5.89 5.71 \012 8:moetmp_1 11.99 12.00 11.12 11.15 9.77 11.12 11.14 11.03 11.09 11.05 \012 9:moetmp_1 4.42 4.42 5.70 5.60 4.67 5.65 5.67 5.66 5.80 5.67 \012 10:moetmp_1 4.45 4.45 5.70 5.60 4.69 5.65 5.67 5.66 5.80 5.67 \012 11:moetmp_1 4.42 4.42 5.73 5.65 4.49 5.69 5.71 5.70 5.85 5.70 \012 12:moetmp_1 3.94 3.93 5.59 5.47 3.73 5.55 5.57 5.53 5.60 5.53 \012 13:moetmp_1 4.05 4.05 5.77 5.69 4.00 5.76 5.77 5.75 5.81 5.74 \012 14:moetmp_1 3.79 3.79 5.89 5.91 4.29 5.87 5.87 5.88 5.93 5.89 \012 15:moetmp_1 3.83 3.83 5.45 5.40 3.70 5.44 5.46 5.42 5.50 5.43 \012 16:moetmp_1 3.42 3.43 4.84 4.78 4.32 4.73 4.76 4.72 4.81 4.78 \012 17:moetmp_1 3.42 3.43 4.84 4.78 4.32 4.73 4.76 4.72 4.81 4.78 \012 18:moetmp_1 3.42 3.43 4.84 4.78 4.32 4.73 4.76 4.72 4.81 4.78 \012 19:moetmp_1 10.10 10.10 13.72 13.24 14.73 13.56 13.61 13.69 13.61 13.71 \012 20:moetmp_1 4.44 4.44 5.68 5.59 4.64 5.64 5.66 5.65 5.79 5.66 \012 21:moetmp_1 0.06 1.54 1.75 3.92 2.42 2.41 2.44 2.43 2.43 \012 22:moetmp_1 0.05 1.55 1.75 3.92 2.42 2.41 2.43 2.42 2.43 \012 23:moetmp_1 0.59 0.57 1.45 5.77 1.51 1.56 1.53 1.66 1.54 \012 24:moetmp_1 1.37 1.36 1.26 5.88 0.83 0.91 0.91 0.86 0.89 \012 25:moetmp_1 1.61 1.61 1.69 1.86 5.89 5.88 5.80 5.87 5.81 \012 26:moetmp_1 1.31 1.30 1.16 0.34 1.93 0.28 0.28 0.30 0.42 \012 27:moetmp_1 1.33 1.31 1.19 0.33 1.95 0.11 0.28 0.41 0.45 \012 28:moetmp_1 1.34 1.33 1.22 0.33 1.92 0.13 0.10 0.33 0.32 \012 29:moetmp_1 1.32 1.30 1.17 0.33 1.90 0.10 0.13 0.12 0.39 \012 30:moetmp_1 1.32 1.30 1.19 0.31 1.87 0.15 0.14 0.14 0.16 \012 31:moetmp_1 1.39 1.38 1.26 0.33 1.95 0.33 0.33 0.34 0.35 0.33 \012 1:moetmp_1 6.02 \012 2:moetmp_1 5.43 \012 3:moetmp_1 6.26 \012 4:moetmp_1 7.38 \012 5:moetmp_1 5.74 \012 6:moetmp_1 7.22 \012 7:moetmp_1 5.66 \012 8:moetmp_1 11.08 \012 9:moetmp_1 5.86 \012 10:moetmp_1 5.87 \012 11:moetmp_1 5.89 \012 12:moetmp_1 5.47 \012 13:moetmp_1 5.68 \012 14:moetmp_1 5.82 \012 15:moetmp_1 5.36 \012 16:moetmp_1 4.97 \012 17:moetmp_1 4.97 \012 18:moetmp_1 4.97 \012 19:moetmp_1 13.58 \012 20:moetmp_1 5.85 \012 21:moetmp_1 3.55 \012 22:moetmp_1 3.55 \012 23:moetmp_1 1.97 \012 24:moetmp_1 1.00 \012 25:moetmp_1 5.96 \012 26:moetmp_1 1.63 \012 27:moetmp_1 1.68 \012 28:moetmp_1 1.62 \012 29:moetmp_1 1.61 \012 30:moetmp_1 1.64 \012 31:moetmp_1 \012

This expression will work for this input data:
`regexReplace(regexReplace(\$column1\$, "[\\d]+:`moetmp_1`" ,""),"\\\\012", "_")`

If the starting tag for the lists changes like â€ś25:moetmp_â€ť, â€ś25:moetmp_1â€ť or â€ś25:moetmp_2â€ť then this will work for all of them:
`regexReplace(regexReplace(\$column1\$, "[\\d]+:moetmp_[\\d]*" ,""),"\\\\012", "_")`

But I noticed that the starting tag for the previous dataset was something like this:
9:moetmp_ where the first value was right after the underscore. If thatâ€™s the case then the above expression does not work.

2 Likes

Indeed, it is not always working because the initial of the expression is changing in each string.
This is how it looks like from the output of the last node:

Let me know whatâ€™s the general rule that makes those starting tags. So I can create a general regex to cover all the cases.

Everything before the first starting tag can be removed easily. Do not worry about that. The main concern here is the format of the tags.

P.S. It seems I have made a mistake in the last workflow. The starting tag was `[\\d]+:moetmp_1` there.
I have edited my previous post containing the workflow.

P.S. In the previous example, some numbers were exactly after the start tag without any delimiter. Thatâ€™s something we should worry about. Could you provide a few more different examples? Then I can consider all the cases. Or let me know the general format.

1 Like