Replace Function in Asterisk

Hi,
I would like to know how to use replace function in asterisk.

Example:-

exten =>_XXXX.,1,(SIP/${EXTEN}@GW1)
exten =>_XXXX.,n,Hangup

I want to replace the GW1 from any other value using replace function in asterisk. i m using version 1.8.18.0 of asterisk.
I m using the replace function like this.
exten =>_XXXX.,1,Set(var=${Replace(SIP/${EXTEN}@GW1,GW1,GW2){)
exten =>_XXXX.,n,(var)
exten =>_XXXX.,n,Hangup

What i get is that var="" empty
why so i m not able to use replace function.Is it available in the version of the asterisk that are using.

This function is relatively new, but it should be in that version.

All the built-in functions have all upper case names.

You have a { where there should be a }.

Some functions like that take a variable name, rather than an expression, but I’m not sure if that is true of REPLACE.

I’ve never seen (var) used before. That’s either a new feature, or wrong.

Sorry that } extra i added here by mistake.

i m replacing the content and then assigning it to a variable var . i have used many other function and use the same set function to initialize it to the variable. but i m facing problem in replace function itself.

If it is not present then in which version can i find the same.

Since when i make menuselect all function provided by asterisk is presented there but the replace function is missing.