I've never tried to execute "match" off a string variable to execute a regex. So, not sure what is up:
function URLDecode(encodedString)
{
var output = encodedString;
var binVal, thisString;
var myregexp = /(%[^%]{2})/;
try
{
while ((match = myregexp.exec(output)) != null
&& match.length > 1
&& match[1] != '')
{
binVal = parseInt(match[1].substr(1), 16);
thisString = String.fromCharCode(binVal);
output = output.replace(match[1], thisString);
}
}
catch (e) { }
return output;
}