REPLACE function

Can anyone show me how to use the REPLACE() function. I cannot get it to work. I want to strip brackets which surround a string. So I want the string to go from this (ASTRING) to this ASTRING

Thanks in advance


REPLACE is called like CUT, with the name of the variable, not the contents. Also, the variable is not modified by REPLACE, but, like CUT, the result is returned.

Here is some sample code:

exten => TEST,1,NoOp(Testing REPLACE)
same => n,Set(VAR=(VALUE))
same => n,NoOp(VAR = ${VAR})
same => n,Set(VAR2=${REPLACE(VAR,(,)})
same => n,NoOp(VAR = ${VAR}, VAR2 = ${VAR2})
same => n,Set(VAR3=${REPLACE(VAR2,),)})
same => n,NoOp(VAR = ${VAR}, VAR2 = ${VAR2}, VAR3 = ${VAR3})
same => n,hangup()

The other thing to note about this is since you are looking to replace a ( and a ), you will need to escape it with the \ so the parser does not misunderstand.

Many thanks for that… Much appreciated…