I am trying to nest an AMPscript function - Replace(). This should take a value and replace it based on what you designate in the function. However, I have two values I need to replace. The "@" symbol in an email address should be replaced by %2 and the "." symbol in the email should be replaced by %4. This is for use in a URL string where the email address is appendeded to be passed and consumed. Currently I have this:
Set @email = [Email Address]
%%=Replace(Replace(@email,"@","%4"),".","%2")=%%
But it's only replacing the @
and not the .
.
Any ideas?
Here is the AMPscript variable block:
<!---ampscript
%%[
/* 101 */ Var @memberfirstname, @memberlastname, @refereefirstname, @refereelastname, @promocode, @rewardpreference, @amountpaid, @email
Set @memberfirstname = member_first_name
Set @memberlastname = member_last_name
Set @refereefirstname= referee_first_name
Set @refereelastname = referee_last_name
Set @promocode = promo_code
Set @rewardpreference = reward_preference
Set @amountpaid = amount_paid
Set @email = [Email Address]
/* 101 */
]%%
/-->
Due to client confidentiality I cannot post the entire URL string. Here is what it looks like without the actual URL:
<a href="https://url.example.com?c=promocode=%%=v(@promocode)=%%&email=%%=Replace(Replace(@email,"@","%40"),".","%2E"=%%"><img border="0" src="http://image.s4.exct.net/lib/fe9015737461027473/m/1/btn-referee-reminder-apply.gif" width="115" height="32" alt="" longdesc=""></a>
%%=Replace(Replace(@email,"@","%40"),".","%2E"=%%