I am trying to extract a specific string of text from my HTML Extract module result.
The HTML Extract module has successfully extracted the following text:
Condition: Used: An item that has been previously used. See the seller’s listing for full details and description of any imperfections. See all condition definitions– opens in a new window or tab ... Read moreabout the condition Year: 2002 Mileage: 42050
Right now I am sending this entire description to Airtable in the subsequent module. Instead, I would like to add a step before sending to Airtable where (using a Javascript function or some other module), I want to perform operations on the text. Specifically:
I want to extract the year and mileage from this text and store those as data points that I send to their respective columns (also called “age” and “mileage” in airtable) along with the other fields extracted from my HTML Extract module.
Any ideas how to do this?
Here is the code behind my HTML Extract Module:
{
"nodes": [
{
"parameters": {
"extractionValues": {
"values": [
{
"key": "title",
"cssSelector": "title"
},
{
"key": "price",
"cssSelector": "span#prcIsum.notranslate"
},
{
"key": "descurl",
"cssSelector": "iframe",
"returnValue": "attribute",
"attribute": "src"
},
{
"key": "specifics",
"cssSelector": "div#viTabs_0_is.itemAttr tbody"
},
{
"key": "photourl",
"cssSelector": "img#icImg",
"returnValue": "value"
},
{
"key": "location",
"cssSelector": "span[itemprop=\"availableAtOrFrom\"]"
}
]
},
"options": {
"trimValues": "=true"
}
},
"name": "HTML Extract",
"type": "n8n-nodes-base.htmlExtract",
"typeVersion": 1,
"position": [
650,
450
]
}
],
"connections": {}
}