CurrentRow("Data") = System.Text.RegularExpressions.Regex.Replace(CurrentRow("Data").ToString,"\D*(\d+)[^\dx]*x[^\dx]*(\d+)[^\dx]*x[^\dx]*(\d+).*","$1 x $2 x $3")
Please note that the above cannot recover all the wrong pattern.
I have to validate that the data in the 6 columns complies with the regex format, if it does not comply, remove the characters that do not correspond, or add those that do correspond (in the event that the spaces are not respected)
If there are empty data in columns 2,3,4,5,6, it is also correct.
Did you try Sample20220510-2v2.zip in my previous post? The expression is as the following.
System.Text.RegularExpressions.Regex.Replace(CurrentRow(column.ColumnName).ToString,"\D*(\d+)[^\dx]*x[^\dx]*(\d+)[^\dx]*x[^\dx]*(\d+).*","$1 x $2 x $3")
Sorry, the above my expression supports only 3 numbers. The following will work for 4 numbers. Can you try this?
System.Text.RegularExpressions.Regex.Replace(CurrentRow(column.ColumnName).ToString,"\D*(\d+)[^\dx]*x[^\dx]*(\d+)[^\dx]*x[^\dx]*(\d+)[^\dx]*x[^\dx]*(\d+).*","$1 x $2 x $3 x $4")
If it’s same as the above input image, the following will work. (If addheader option is off)
Row(0) = System.Text.RegularExpressions.Regex.Replace(Row(0).ToString,"\D*(\d+)[^\dx]*x[^\dx]*(\d+)[^\dx]*x[^\dx]*(\d+)[^\dx]*x[^\dx]*(\d+).*","$1 x $2 x $3 x $4")
For now, can you try as the following? (Please turn off at add headers option in ReadRange)
Row(0) = System.Text.RegularExpressions.Regex.Replace(Row(0).ToString,"\D*(\d+)[^\dx]*x[^\dx]*(\d+)[^\dx]*x[^\dx]*(\d+)[^\dx]*x[^\dx]*(\d+).*","$1 x $2 x $3 x $4")