Any tip (regex) to clean up a url with a bugged up parameter❓

My URL has a parameter syntax that is the result of a click on a complexe formula with repeat.
See categParam:

Reason is, I use the repeated info as a parameter for the next page load. Repeat is from:
GROUP(FLATTEN(MAP(FLATTEN(MAP(SELECT(data.ProvidersDB, item.currency==appVars.userCurrency),, item.category)), item.token, {token: key + " ("+ COUNT(items)+")"})
Example in plain text: STAY (5)

I need to get ride off the parenthesis + inside so that the param works as intended - with ‘stay’ text only. Any best trick?

Found the regular expression (regex) for removing the parenthesis and its content:


Now not sure about its exact input within this formula which wont accept \s*\([^)]*\) between double quotes:

REPLACE_ONE_REGEX(ENCODE_JSON(repeated.current.token), "\s*\([^)]*\)", "")

AppGyver team @Kirill_Leventcov, the examples in your binding editor REPLACE_ONE_REGEX("foo foo baz", "\\s", "-") suggest the regex pattern should be between double quotes, but it won’t accept my double quotes. Please advise, thanks.

the examples in your binding editor … suggest the regex pattern should be between double quotes

Not necessarily, formulas support both single-quoted and double-quoted strings:


Furthermore, the backslash \ is an escape character and is reserved for use as an escape character in JavaScript. To escape the backslash in JavaScript, use two backslashes (Source).


Meaning, to get your formula to work, simply add a single backslash to other backslashes:



Thank you!
Do you know what to add to the regex for removing the resulting double quotes too? ie: how to insert this ["]+/g ?

For that, use REPLACE_ALL