getQueryStringParam() fixes

Regex bugfixes and abstracting URI component decoding from the other code.