How to extra urls from email body content

I am trying to extra the URL’s from the body of this email, it is for a user feedback email I get.

My plan is to extract the URLs separately and map them to a column inside a spreadsheet.

The content will vary but not the structure, so I somehow need to make it work for all use cases.

The Referrer is where the user came from e.g google search, internal page - its a full url path

The second is the page they posted the feedback from, so it will read as: /path/path etc - essentially it starts with a forward slash.

I have a google spreadsheet module where I plan to insert the regex rules.

Any help appreciated

You can try the module Text Parser > Match elements

Set the Pattern to HTTP address

This will return all URLs within the input text.

Hello @MaxW,
Yes you can easily achieve this using module Text Parser > Match elements as @XenoMax suggest.
But there are lots of things that need to be considered. Check this full topic.

I hope this helps. :+1:

It worked great, how would you extract both URL?

I havent read too much into your topic suggestion, the textparser does work but only gets the first url, is there any way to get the second? also it costs an operation so I am hoping I can do it within the spreadsheet module - is that possible?

It should return a separate bundle for each URL:

If it’s not, an example of your input text may help me check what might be up.

Thanks for getting back, here’s an example:

Referrer:

URL:
/answers/er-versus-sr-486490.html

Use Match pattern module instead.
Pattern: (https?:\/\/[^\s]+|\/[^\s]*)


Thanks, it was able to extract both URL’s, the google sheet add row module didn’t pickup the second bundle though?

Maybe the scenario has something to do with it. I removed the text parser for now just to show what I currently have set up.

It currently uses ChatGPT to extract the URL’s, but wondering if that’s extra tokens I’m wasting per run.

If you’re wanting to put all URLs into a single cell in the sheet:

1 Like

where abouts would that go in my build?

Also is there a way to add a filter in between the gmail and chatgpt module that filters negative comments only?

Theres a line that says Response: positive or Response: negative

They are line break separated though, and a user might mention positive or negative in their feedback, so wondering if its possible or not?

Text parser would go after GPT, and then add the aggregator next to it, and then you have your Google Sheet to make use of the output.

To prevent Positives from going through, you can set a filter:

This will only allow texts that contain that exact text to go through. You actualy can just add a new line, but I made use of the magic keyword as it’s probably safer. Setting this as a filter as soon as you have your text block available will avoid further unnecessary processing.

1 Like