Best answer

How do I add spaces between words using Formatter?


 

 

In order to match a string I need to add spaces to my incoming search string. When I use Formatter:Replace and [:space:] it seems to trim the spaces away. Her is my Formatter action:

 

And here are my results:

Thanks for any help.

BK

icon

Best answer by christina.d 3 May 2022, 05:28

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.

10 replies

I also tried Javascript replace but I got the same results. Something keep taking away my leading and trailing spaces:

 

Userlevel 7
Badge +9

Hi @Busted Knuckles! 👋🏽Thanks so much for reaching out and sharing those details.

I did some digging and it looks like you’re experiencing a known bug with the Formatter app, specifically where Split Text isn’t working with [:space:] Separator 😔 . I don’t have an ETA for a fix at the moment, but I did add you as an affected user!  This will ensure you’re emailed once a solution is available. We’ll also be sure to keep the thread updated as well.

Thanks again for flagging this and welcome to the Community!

Does anyone know of a workaround? 

Userlevel 7
Badge +9

Totally valid question, @Busted Knuckles! I might recommend opening a ticket with our friends in support to dig into this a bit more with you. Feel free to link them to this community post as well to show what steps you’ve done to troubleshoot! 

Userlevel 7
Badge +14

@Busted Knuckles 

A commonly used entity in HTML is the non-breaking space:  

Try this JavaScript Code:

let Term = inputData.Term.replace(/ near /i,"  near   "); 

output = [{Term}];

 

 

Thanks for your suggestion Troy. But it didn’t work as expected: My results is

Term

Bank  near   me. Below is my configuration:

 

Userlevel 7
Badge +14

@Busted Knuckles 

That is the expected output: Bank  near   me

A commonly used entity in HTML is the non-breaking space:  

Have you tried using the output value in your next action step?

Sorry Troy. I should have known to do that. Since testing only pulls in one result and I need many I’ve turned it on and should know by late tomorrow morning. I will update you then. Thank you.

Userlevel 7
Badge +14

@Busted Knuckles

How to change your test trigger data: https://zapier.com/help/create/basics/change-the-test-data-in-your-zap-trigger

 

Can you elaborate about how you are trying to use the output in your next action step, that may help us have more context and advise about potential solutions.

Well it turns out that I didn’t need to do anything to remove the excess spaces in the targeted string. Zapier’s Filter removed them for me. So when a string with more than one space between the words is put in the Filter, the filter removes all but one. How about that for luck. Thanks everyone for their suggestions.