Extract an email from a text block?

Describe the problem/error/question

I have an input with a few variouations of emails. Here is a version that resembles it:

#Business Name Here **AccountId:** RMheSxxXmCBYajyW3 **Phone:** 0400000000 **Email:** [test\@domainname.com] [test\@domainname.com]: mailto:[email protected]?subject=RE:%20%Some%20request%20-%20&[email protected] **Address:** 21 Some Street Some City **User:** Bilbo Baggins **Requested:** 7:49pm - Thu 21 Dec 2023 **Platform:** undefined **Browser:** chrome ##Requested Information _This is some user string_

I want to extract the email only that is the correct one for the customer. In this case, it’s the one after the mailto. Like so mailto:[email protected]

Please share your workflow

{
“meta”: {
“instanceId”: “8b0d1d49623bacb1c7ed02c02a2fc7dd214628c2e6fa32841c459db0315f6129”
},
“nodes”: [
{
“parameters”: {
“id”: “581beca96f314d6a7c6a2144”
},
“id”: “7410856f-4d1f-406e-b92e-f12921bc99ef”,
“name”: “Trello Trigger”,
“type”: “n8n-nodes-base.trelloTrigger”,
“typeVersion”: 1,
“position”: [
600,
260
],
“webhookId”: “215b2416-d8e8-4152-870b-a2f667e470c3”,
“credentials”: {
“trelloApi”: {
“id”: “5”,
“name”: “Trello account”
}
}
},
{
“parameters”: {
“conditions”: {
“string”: [
{
“value1”: “={{ $(‘Trello Trigger’).item.json.action.type }}”,
“value2”: “createCard”
}
]
}
},
“id”: “91fb5105-2106-478c-a471-6b5d6a357f4b”,
“name”: “IF”,
“type”: “n8n-nodes-base.if”,
“typeVersion”: 1,
“position”: [
940,
260
]
},
{
“parameters”: {
“operation”: “get”,
“id”: {
“__rl”: true,
“value”: “={{ $json.action.display.entities.card.id }}”,
“mode”: “id”
},
“additionalFields”: {}
},
“id”: “d6639464-0173-4240-82dc-da42eb0442a0”,
“name”: “Trello1”,
“type”: “n8n-nodes-base.trello”,
“typeVersion”: 1,
“position”: [
780,
260
],
“credentials”: {
“trelloApi”: {
“id”: “5”,
“name”: “Trello account”
}
}
},
{
“parameters”: {
“fieldToSplitOut”: “desc”,
“options”: {}
},
“id”: “44f9f310-be2f-4d5c-b356-9e6609baced1”,
“name”: “Item Lists1”,
“type”: “n8n-nodes-base.itemLists”,
“typeVersion”: 3,
“position”: [
1180,
240
]
},
{
“parameters”: {
“keepOnlySet”: true,
“values”: {
“string”: [
{
“name”: “email”,
“value”: “={{ extractEmail($json["desc"]) }}”
}
]
},
“options”: {}
},
“id”: “70be171a-92f9-4be9-8321-d1a769d1cae1”,
“name”: “Set1”,
“type”: “n8n-nodes-base.set”,
“typeVersion”: 2,
“position”: [
1380,
240
]
}
],
“connections”: {
“Trello Trigger”: {
“main”: [
[
{
“node”: “Trello1”,
“type”: “main”,
“index”: 0
}
]
]
},
“IF”: {
“main”: [
[
{
“node”: “Item Lists1”,
“type”: “main”,
“index”: 0
}
]
]
},
“Trello1”: {
“main”: [
[
{
“node”: “IF”,
“type”: “main”,
“index”: 0
}
]
]
},
“Item Lists1”: {
“main”: [
[
{
“node”: “Set1”,
“type”: “main”,
“index”: 0
}
]
]
}
}
}

Share the output returned by the last node

[

{

}

]

Information on your n8n setup

  • n8n version: 1.1.1
  • Database (default: SQLite):
  • Running n8n via (Docker):
  • Operating system: Linux

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

@privateuserguy , try this instead, {{$json["desc"].extractEmail()}}.

1 Like

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