title: perl regex matching infohash from magnet link
body: <p>im trying to extract an info hash from a torrent magnet link using perls regex
  <br>the magnet link looks like: <br></p>
  
  <p>magnet:?xt=urn:btih:8AC3731AD4B039C05393B5404AFA6E7397810B41&amp;dn=ubuntu+11+10+oneiric+ocelot+desktop+cd+i386&amp;tr=http%3A%2F%2Ftracker.openbittorrent.com%2Fannounce
  <br><br>but sometimes it can look like:<br>
  magnet:?xt=urn:btih:8AC3731AD4B039C05393B5404AFA6E7397810B41</p>
  
  <p>the part im trying to extract is 8AC3731AD4B039C05393B5404AFA6E7397810B41</p>
  
  <p>im trying to capture everything upto the first '&amp;' or if it only includes the infohash then upto the end of the line, ive tried a couple way but cant get it to work correctly<br>what i have below only captures the first character</p>
  
  <pre><code>if ($tmpVar =~ m/magnet\:\?xt=urn\:btih\:([[:alnum:]]+?)/i) {
    $mainRes{'hash'} = $1;
  }
  </code></pre>
  
  <p>i also tried adding &amp;|$ after the capture but that just results in an error<br>
  Thanks</p>