REGEX_REPLACE to replace text in variable

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 :slight_smile:

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," ","_") & "}"

3 Likes

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.

This topic was solved and automatically closed 3 days after the last reply. New replies are no longer allowed.