Question

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

  • 31 March 2023
  • 6 replies
  • 116 views

Userlevel 4
Badge +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

Userlevel 7
Badge +14

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

Userlevel 7
Badge +14

@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

Userlevel 4
Badge +4

Thanks @Troy Tessalone , 

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

M.

Userlevel 3
Badge +4

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! 😊

Userlevel 4
Badge +4

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

Best, M.

Userlevel 7
Badge +14

@michael291 

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