Best answer

How to extract a unique ID from a URL pattern using the Zapier Formatter?

  • 17 August 2023
  • 3 replies

Userlevel 2
Badge +1

I have a sense that I can do this with the Formatter, but I’m not quite sure how to do it? 

Overall, i’m looking to extract a unique Id from within a url pattern, for example{string-of-numbers-and-letters}/edit

  • My trigger will include a chunk of HTML content. 
  • I’ll filter the Zap steps to only continue when it contains the beginning URL structure i’m looking for, but the URL itself will be wrapped within a bunch of other text and html code


<p> hey, danny.</p>
<p> try this link:{string-of-numbers-and-letters}/edit </p>
<p> hope this helps!</p>

How do I go about extracting that unique Id string from within the URL pattern so that I can use it in subsequent steps? 

(If it helps, my use case is that subsequent steps are using this unique Id in API calls that need that Id)


Best answer by Troy Tessalone 17 August 2023, 21:44

View original

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

3 replies

Userlevel 7
Badge +14

Hi @ddpancratz 

Good question.


  1. Ask AI
    1. Zap action: ChatGPT - Extract Structured Data
  2. Code
    1. Custom JavaScript
  3. Formatter > Text > Split
    1. Multiple Zap actions
  4. Formatter > Text > Extract Pattern
    1. Try this:




Userlevel 6
Badge +8

A Code by Zapier Python step would do it.

Assuming you map that URL to an Input Data field called `url`:


output = [{'part_i_want': input_data['url'].split('/')[-2]}]



Userlevel 2
Badge +1

Thanks, all. We’ve solved this with the code step.