Skip to main content

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

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


@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


Thanks @Troy Tessalone , 

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

M.


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


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

Best, M.


@michael291 

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