Skip to main content
Question

How to grab/filter placeholders in text using %%%NAME%%% ?

  • March 31, 2023
  • 6 replies
  • 207 views

michael291
Forum|alt.badge.img+4

Hello,

I am looking for a way to grab/filter placeholders in a text.

A text field contains several placeholders (i.e. %%%First_Name%%%, %%%Last_Name%%% and %%%Email_Address%%%. And I want to replace those placeholders with the corresponding values from a previous step in a Zap.

 

So the text will look like this: 

Hello %%%First_Name%%% %%%Last_Name%%%, 
thanks for subscribing with %%%Email_Address%%%. 

Thanks a lot, 
Michael

 

And it should be replaced with: 
Hello John Doe, 
thanks for subscribing with jon.doe@mail.com. 

Thanks a lot, 
Michael

 

I know there is a Zapier replace feature, but I was thinking about a more flexible solution and I don’t want to use a new “Replace” step for each placeholder. 

How can I do this?

Thanks for help, 
Michael

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

Troy Tessalone
Zapier Orchestrator & Solution Partner
Forum|alt.badge.img+14
  • Zapier Orchestrator & Solution Partner
  • March 31, 2023

Hi @michael291 

Good question.

This can be done with a Code step: https://zapier.com/apps/code/help

If using JavaScript, then use the .replace() method.

https://www.w3schools.com/jsref/jsref_replace.asp


Troy Tessalone
Zapier Orchestrator & Solution Partner
Forum|alt.badge.img+14
  • Zapier Orchestrator & Solution Partner
  • March 31, 2023

@michael291 

Another option to explore is using AI with a prompt of instructions and examples.

ChatGPT: https://zapier.com/apps/chatgpt/integrations#triggers-and-actions

OpenAI: https://zapier.com/apps/openai/integrations#triggers-and-actions


michael291
Forum|alt.badge.img+4
  • Author
  • Builder
  • March 31, 2023

Thanks @Troy Tessalone , 

do you have a code example for the first solution with the Zapier Code step? 

M.


Charie
Forum|alt.badge.img+4
  • Zapier Staff
  • April 3, 2023

Hello @michael291 

You may check this link for code samples: https://help.zapier.com/hc/en-us/articles/8496011910029-StoreClient-Javascript-#bulk-operations-0-0

Let me know if you have other questions! 😊


michael291
Forum|alt.badge.img+4
  • Author
  • Builder
  • April 4, 2023

Thanks @Charie , I will have a look at it. 

Best, M.


Troy Tessalone
Zapier Orchestrator & Solution Partner
Forum|alt.badge.img+14
  • Zapier Orchestrator & Solution Partner
  • April 6, 2023

@michael291 

You can try asking ChatGPT for the JavaScript Code: https://chat.openai.com