title: Powershell get lines between multiple xml tags
body: <p>I'm currently trying to construct a powershell script, which could read specific XML file and pull certain words. These words would be located between tags.</p>
  
  <p>Currently the file would look like this. Let's call it events.xml:</p>
  
  <pre><code>&lt;Computer&gt;Hostname&lt;/Computer&gt;&lt;Other&gt;Random Text&lt;/Other&lt;Other&gt;More Random Text&lt;/Other&gt;&lt;FilePath&gt;notepad.exe&lt;/FilePath&gt;
  </code></pre>
  
  <p>What I would like to do, is use Powershell script to extract words between <code>&lt;Computer&gt;&lt;/Computer&gt;</code> and <code>&lt;FilePath&gt;&lt;/FilePath&gt;</code> tags and echo them to Powershell.</p>
  
  <p>So far I have this:</p>
  
  <pre><code>gc events.xml | % { [regex]::matches( $_ , '(?&lt;=&lt;Computer&gt;)(.*?)(?=&lt;/Computer&gt;)' ) } | select -expa value
  </code></pre>
  
  <p>Which works in a way, as it prints out a list of all the characters in between <code>&lt;Computer&gt;&lt;/Computer&gt;</code> tags flawlessly. But the challenge comes when trying to get a script to work so it would print out between BOTH (<code>&lt;Computer&gt;&lt;/Computer&gt;</code> and <code>&lt;FilePath&gt;&lt;/Filepath&gt;</code>) lines. So it would come out as:</p>
  
  <p>Hostname<br>Notepad.exe</p>
  
  <p>And so forth.</p>
  
  <p>Any ideas or suggestions?</p>
  
  <p>Thank you!</p>