title: Extracting from Response Header with Regular Expression
body: <p>I'm trying to extract the confirmation number at the end of the location tag in the response header to a page using RegEx.  The response header is as follows:</p>
  
  <pre><code>HTTP/1.1 302 Moved Temporarily
  Date: Mon, 09 Sep 2013 17:55:50 GMT
  Server: Apache-Coyote/1.1
  Location: http://test.regtest.com/cart/confirmation?confirmationNumber=00284031
  Content-Language: en
  Content-Length: 0
  X-Cnection: close
  Content-Type: text/plain; charset=UTF-8
  Vary: Accept-Encoding
  </code></pre>
  
  <p>For instance, if in the header the line is this:</p>
  
  <pre><code>Location: http://test.regtest.com/cart/confirmation?confirmationNumber=00284031
  </code></pre>
  
  <p>I am looking to return this to use as a variable later:</p>
  
  <blockquote>
    <p>00284031</p>
  </blockquote>
  
  <p>My current RegEx expression is something like this:</p>
  
  <pre><code>Location: http://test.regtest.com/cart/confirmation?confirmationNumber=(\d+)?
  </code></pre>
  
  <p>I am new to RegEx and what I wrote above is based off the example at the following link:</p>
  
  <p><a href="http://www.sourcepole.ch/2011/1/4/extracting-text-from-a-page-and-using-it-somewhere-else-in-jmeter" rel="nofollow">http://www.sourcepole.ch/2011/1/4/extracting-text-from-a-page-and-using-it-somewhere-else-in-jmeter</a></p>
  
  <p>I need this confirmation number for a dynamic page redirect for a Jmeter script I am writing.  Any help would be greatly appreciated and if you require additional information to help answer the question let me know!</p>
  
  <p>Many thanks in advance.</p>