title: How to extract data for non-fixed string
body: <p>I have some <a href="http://en.wikipedia.org/wiki/Magnet_uri" rel="nofollow"><code>magnet</code></a> links being submitted as string in <strong>Lua</strong>. These magnets normally are of the format:</p>
  
  <pre><code>magnet:?xt=&lt;hashing&gt;&amp;xl=&lt;size&gt;&amp;dn=&lt;name&gt;
  </code></pre>
  
  <p>but with differences in the clients the magnets can also be generated as:</p>
  
  <pre><code>magnet:?xl=&lt;size&gt;&amp;xt=&lt;hashing&gt;&amp;dn=&lt;name&gt;
  </code></pre>
  
  <p>From this type of string, I want to fetch the data after <strong><code>xl=</code></strong>(which is pure number) and after <strong><code>xt=</code></strong> which consists of <code>%w</code> and <code>:</code>(where <code>%w</code> is alphanumeric match).</p>
  
  <p>Currently I am using two separate statements to fetch these values. Can this be achieved in a single statement/<code>string.find()</code>?</p>
  
  <pre><code>sInput = "magnet:?xt=urn:tree:tiger:ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ABC&amp;xl=1234567890123456789&amp;dn=This+Is+The+Name+Of+File.EXT"
  local _, _, sHash = sInput:find( "xt=([%w%:]+)" )
  local _, _, iSize = sInput:find( "xl=(%d+)" )
  </code></pre>