SPGetQueryString Replace Method

Apr 3, 2012 at 7:00 PM

Hi All, was hoping you could help clear things up regarding the SPGetQueryString function--specifically the line that uses the 'replace' method.  The line currently is written as...

queryStringVals[matches[1]] = unescape(matches[2]).replace('+', ' ');

 It seems in this configuration it's only replacing the first instance of the '+' symbol in the target string. I'm wondering if the following might work better:

queryStringVals[matches[1]] = unescape(matches[2]).replace(/\+/g,' ');

In the modified case, it performs a global replace on the target string to replace all instances of the '+' symbol. Now, that being said, I am admittedly a rookie when it comes to RegExp so I may be way off the mark here.  Any thoughts?

GKO

 

Coordinator
Apr 13, 2012 at 9:22 PM

GKO:

What you show here certainly seems to make sense. I wrote (or borrowed) that script so long ago that I can't even remember what I was trying to cover there. I'll add this to the Issue Tracker. I haven't ever received any reports of issues, though, so let me know if you see anything working unexpectedly.

M.

Coordinator
Apr 13, 2012 at 9:23 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.