Skip to main content

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?

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.


@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/a^\s]*'

matches = re.findall(pattern, text)

for url in matches:
    print(url)
 


@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/