title: Perl extract group with lookbehind from different line
body: <p>I've tried web search and have read several answers on stackexchange, still cannot grasp why command does not extract anything. At the end I want to extract group with lookbehind from different line, e.g. from </p>
  
  <pre><code>Code&gt;TEST1&lt;Code Code2&gt;best&lt;Code2
  Code&gt;test2&lt;Code
  Type&gt;false&lt;Type
  </code></pre>
  
  <p>by finding needed key between <code>Type</code> and extracting first <code>Code</code> above the finding, so it case above to get <code>test2</code>. But I cannot succeed to extract even something from multiple lines, i.e. </p>
  
  <p><code>perl -lne 'print $1,"_",$2 if /Code&gt;(.*)&lt;Code[\s\S\n]*?Type&gt;(.*)&lt;Type/'&lt;test.txt</code> prints nothing.<br>
  I've played with removing <code>ln</code> parameters and adding/removing greedy <code>?</code> and trying just <code>.</code> in place of <code>[\s\S\n]</code>.  </p>
  
  <p><code>perl -lne 'print $1,"_",$2 if /Code&gt;(.*)&lt;Code[\s\S\n]*?Code2&gt;(.*)&lt;Code2/'&lt;test.txt
  </code> gives <code>TEST1_best</code> so same line extraction works.  </p>
  
  <p>What am I missing? Can what I want be done in one line of command?</p>