0 Replies Latest reply on Apr 22, 2010 8:15 AM by Jerry62712

    How does replace work?

    Jerry62712 Level 1

      I have an encoded string that I want to decode:

       

                  // input:   %3cFSParm%3e%3cHouseholdSize%3e03%3c%2fHouseholdSize%3e

                  var locDecodeParm:String = decodeURI(locationParm);

                  //  output:<FSParm><HouseholdSize>03<%2fHouseholdSize>

       

      The problem is "%2f" won't decode to "/".  So I tried:

       

                  var pattern:RegExp = /<%2f/gi;
                  locDecodeParm.replace(pattern,"</");

       

      And variations on that (locDecodeParm.replace("%2f","/" for example) that also don't work. Nor did "//" or "\/".

       

      Why can't I get this to work?