Help

REGEX_REPLACE to replace text in variable

Topic Labels: Formulas
Solved
Jump to Solution
2159 2
cancel
Showing results for 
Search instead for 
Did you mean: 
FrankLovesAirta
5 - Automation Enthusiast
5 - Automation Enthusiast

Dear community,

first of all I really appreciate this forum, even if just as a silent participant so far. I’m pulling my hair out trying to replace strings in variables to make them ready for webmerge/formstack documents.

Input string: my webmerge variable
Wanted result: {$my_webmerge_variable}

Formula I am using: REGEX_REPLACE(REGEX_REPLACE({regex test},"\A","{$"), “\s”, “_”)
Result I am getting: {$my_webmerge_variable

How do I get the closing brace = } at the end of the variable? I tried $ and \z but they don’t seem to be working. Thank you all in advance, any help is much appreciated :slightly_smiling_face:

1 Solution

Accepted Solutions
ScottWorld
18 - Pluto
18 - Pluto

Welcome to the community, @FrankLovesAirtable!

I’m not a REGEX expert, but are you just looking to add brackets & replace the spaces with underscores?

If so, you could just do it simply like this:

"{$" & SUBSTITUTE(Input," ","_") & "}"

See Solution in Thread

2 Replies 2
ScottWorld
18 - Pluto
18 - Pluto

Welcome to the community, @FrankLovesAirtable!

I’m not a REGEX expert, but are you just looking to add brackets & replace the spaces with underscores?

If so, you could just do it simply like this:

"{$" & SUBSTITUTE(Input," ","_") & "}"

Dear @ScottWorld,

you help is very much appreciated and your solution works perfectly well. This function also seems to be more of the standard repertoire from Airtable so to speak, using this one from now one. Tagged as Solution. Thank you.