I need to extract an email address from a message

Hi there,

I could not find the answer to my need, so any help is highly appreciated.

I’m trying to find a way to extract an email address sent from the user via chat conversation and then send this email address to a Google spreadsheet.

In other words, how can I separate only the email address from the whole conversation? Is there a node for this?

Thank you in advance…!

1 Like

Youd need to use an OCR functionality or AI agent to accomplish this if the chat doesnt include a form.

Do you need more information on how to accomplish this task or would you rather use a form application to gather the required data from the message?

1 Like

Hi @vball,

Here’s a workflow where you can use a second agent to output the email into the sheet. It could also be completed with a tool if you want to keep the flow a little cleaner.

Best,

Robert

Hi @diego.lagolago

I do this manually with another agent, or a tool. Can you explain how you would do it with OCR? Would be great if I didnt need to jump through hoops like I do now.

Best,

Robert

Hi @vball

There are many ways to achieve this. One approach I use to save AI credits is to parse user messages and apply a regex pattern to extract email addresses, For example:

So, in the end, it depends on your actual needs and limitations…

Excuse me, OCR was wrong since you’re not scanning documents.

You’d need to apply information extractor AI agent to get the email address from a text.

Regex might work but only in certain scenarios since the provided code only works for top level domains with a length of 2 characters (.gg, .at, .de) but would fail with longer TLDs (.com, .net, .shop) since it would only get the first 2 characters after the separator (.)

The code would return something like: “[email protected], [email protected], [email protected]

Really, only the information extractor is gonna help you in your scenario.

Mistral offers the small version as a free API endpoint.

1 Like

Thats helpful thanks. Much easier than the steps I was taking.

This is not true. The {2,} quantifier matches 2 or more occurrences of the preceding subpattern.

2 Likes

It’s simple, You can do it through code:). Let me give you the code, first, If possible can you provide your workflow json ?

1 Like

Good to know, I am obviously not the best in regex.

Still, double domains like .co.uk arent being catched. Correct me if I am wrong again :wink:

Hi, I’m just flabbergasted why this couldn’t be a question for an AI. If there is a use case this would be one :slight_smile: again, with all due respect.
Reg,
J.

1 Like

They are. You can easily test this and you should before putting someone’s solution at a doubt publicly. Ignorance or lack of knowledge is not a valid excuse.

I think you owe Mohamed an apology. This is a community despite we’re only present here virtually.

3 Likes

There are many ways to do the same:

RegEx
It’s the optimized one (to save ai tokens, computing faster…). You can detect/extract anything you want (use chatgpt to fix expressions) .

AI
Use AI if any of the next situations:

  • expression/text is complex
  • costs/speed doesn’t matter
1 Like

Good morning Gentlemen,

Thank you very much for all your efforts to help me. I think I got what I wanted with the suggestion of @diego.lagolago using the information extractor. It worked just fine!

Thank you all!

1 Like

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