Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I have used this awesome post in the post for getting query string data from the URL: How can I get query string values in JavaScript?

However, i am now in a situation where the query string values are base64 encoded, e.g:

"param1": "yA26LZ6+SxFEgNuF86/SIXfimGlg="
"param2": "f4x0Dh*6iZCXtX8nhiSb3xahNxrg="

I've done some research and apparently this regex can handle base64:

^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$

How can i adapt the function to incorporate this regex?

What i am trying to do is create a JavaScript function that looks are the URL, can gets the value for a particular paramter:

wwww.mydomain.net/reset.html?param1=76+hgfh5464/rte69&?userId=23243*--++/231\

Here you cans see 2 parameters:

param1
userId
share|improve this question

put on hold as unclear what you're asking by bodi0, RGraham, Anonymous, Evan Knowles, Royi Namir yesterday

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

    
You seem to have forgotten to include what you are actually trying to do. Are you checking a string to see if it is base64 encoded? –  Anonymous yesterday
    
How can i adapt the function to incorporate this regex - I'm not sure what you're asking. In what way incorporate it? What have you tried so far, other than copying/pasting code from elsewhere. –  RGraham yesterday
    
I believe he's trying to get Base64 query string values out of the string, but presumably the Base64 = padding is breaking the standard regex. I'm not sure query strings support having values with = in them. –  Evan Knowles yesterday