title: Select-String regex in Powershell
body: <p>I am using Regex to select a string in a file. My problem is that <code>Select-String</code> is always using the whole line from the file. Here is my Code:</p>
  
  <pre><code>($a = Select-String -path C:\Users\boriv\Desktop\Patrick\regex\spec.ini -pattern "PD[0-9]{3}[A-Z]{2}\n")
  </code></pre>
  
  <p>My spec.ini file looks like this:</p>
  
  <pre><code>[SPEC LOCATIONS]
  DV920_DataSource=Central Objects - DV920
  DV920_Package=DV920FA
  PD920_DataSource=Central Objects - PD920
  PD920_Package=PD920FA
  PS920_DataSource=Central Objects - PS920
  PS920_Package=PS920FA
  PY920_DataSource=Central Objects - PY920
  PY920_Package=PY920FA
  </code></pre>
  
  <p>As output I need only the PD920FA from the line:</p>
  
  <blockquote>
    <p>PD920_Package=PD920FA</p>
  </blockquote>
  
  <p>Is there an alternative way to do this other than via <code>Select-String</code>?</p>
  
  <p>I have also tried to use the Where Object but it didn't work.</p>
  
  <p>My Regex works here is the Link:
  <a href="https://regex101.com/r/k5rkdx/1" rel="nofollow noreferrer">Regex</a></p>