Splitting cell strings from a table to different cells

What nodes should be used in order to achieve said goal ?
#1 png - What i have right now.
#2 png - What im aiming for.


ND1.knwf (86.5 KB)

Data that im working with

Hi @Zaza

You could potentially use a Regex Split node but that can be a bit tricky to properly write. You could also opt for a Column Expression node and build all the required columns directly from there using a RegexReplace function:

Engine:
regexReplace(column("Row0"), "(.+?Specs)(\\d+).*", "$1")

Year:
regexReplace(column("Row0"), ".+?(\\d{4}).*", "$1")

HP:
regexReplace(column("Row0"), ".+?Specs\\d+(\\d+ hp / \\d+ kW).*", "$1")

Displacement:
regexReplace(column("Row0"), ".+?Specs\\d+\\d+ hp / \\d+ kW(\\d+ cm3 \\(.*?\\)).*", "$1")

Hope this helps!

3 Likes

Looking at your actual data source again, I noticed that one XPath Query is able to retrieve the same data.

You only have the change the last td[] in this query. The wildward in the dns:tr[] ensures that all records are retrieves within that table.

/dns:html/dns:body/dns:section/dns:div/dns:div/dns:div/dns:div/dns:div[4]/dns:div/dns:div[3]/dns:div/dns:div[10]/dns:table/dns:tbody/dns:tr[*]/dns:td[1]

5 Likes

Thank you so much, it worked perfectly, have a great day/ evening ^^

1 Like

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