IC SunsetThe developerWorks Connections platform will be sunset on December 31, 2019. On January 1, 2020, this forum will no longer be available. More details available on our FAQ.
Topic
  • 1 reply
  • Latest Post - ‏2014-09-20T12:02:43Z by jitupkp
SystemAdmin
SystemAdmin
1140 Posts

Pinned topic How do I replace any ampersands in a text string with another character ?

‏2011-06-03T07:58:07Z |
I am passing a string into a PHP URL and all works fine until the string contains one or more ampersands, then as expected any text following the ampersand is allocated to another parameter. I am using string.replace to identify and replace the & with a hyphen and have tried a number of different ways to define an ampersand in the regexp, all to no avail. Pretty basic I know.. but it has me stumped.
Any assistance gratefully received.