Getting values from a response based on an "expected response" expression
<p>I have an expected response, which <strong>could be in any format</strong>, but for example:</p>

<pre><code>myfoo={FOO}&amp;mybar={BAR}&amp;mybaz={BAZ}
</code></pre>

<p>Then I have the response string:</p>

<pre><code>myfoo=hello&amp;mybar=test&amp;mybaz=yup
</code></pre>

<p>So my question is, in JavaScript, how can I use these two strings to create an object containing the values, like so:</p>

<pre><code>{
    FOO : 'hello',
    BAR : 'test',
    BAZ : 'yup'
}
</code></pre>

<hr>

<p>In another example the expected string could be a sentence:</p>

<pre><code>Hello, my name is {NAME} and I am {AGE} years old.
</code></pre>

<p>Then the actual response:</p>

<pre><code>Hello, my name is Fred and I am 30 years old.
</code></pre>

<p>Which should build:</p>

<pre><code>{
    NAME : 'Fred',
    AGE : '30'
}
</code></pre>
