Question

How do I specify which URL to extract from an email using Formatter by Zapier?

  • 1 August 2023
  • 6 replies
  • 237 views

Hello! I am trying to extract a specific URL and send it to a Slack channel.

When I try to Extract URL from Zapier’s formatter, it only pulls the first URL it sees, and we need to extract a URL further down the Body HTML. 

How do I specify which URL to extract? The URL I want to extract from each email has a similar pattern, but ends in a different code each time.

How can I Fix this?


This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

6 replies

Userlevel 7
Badge +14

Hi @bradyk00 

Good question.

Couple options:

  1. Formatter > Text > Extract Pattern
  2. Formatter > Text > Split + Formatter > Text > Extract URL
  3. Code

When I enter the pattern, can I just enter the beginning of the URL? That doesn’t seem to work.

Userlevel 7
Badge +14

@bradyk00 

Check the field description for guidance about using Python regex.

So I am looking to find any URLs that start with - https://auth.ahrefs.com/auth/ and place the whole URL into a message to send to Slack.

Would this be the Regex formula I would enter into Zapier? I’m not familiar with Python Regex:

 

import re

text = 'Your text with https://auth.ahrefs.com/auth/specific-path and other contents'

pattern = r'https://auth\.ahrefs\.com/auth/[^\s]*'

matches = re.findall(pattern, text)

for url in matches:
    print(url)
 

Userlevel 7
Badge +14

@bradyk00

Try this pattern:

https://auth\.ahrefs\.com/auth/[^\s]*

 

 

Your ultimate destination for World Cup betting excitement! We’re all about taking your love for the game to the next level. Get ready to dive into thrilling sports betting experiences that revolve around the global phenomenon of the World Cup. With top-notch tech, ironclad security, and a focus on your enjoyment, is here to make your World Cup moments unforgettable. Let’s kick off winning together! https://www.yolo247.com/sports/tournaments/odi-world-cup-betting/