title: Extract all Capitalized words from document using PowerShell
body: <p>Using PowerShell extract all Capitalized words from a Document. Everything works until the last line of code as far as I can tell. Something wrong with my RegEx or is my approach all wrong?</p>
  <pre><code>#Extract content of Microsoft Word Document to text
  $word = New-Object -comobject Word.Application
  $word.Visible = $True 
  $doc = $word.Documents.Open(&quot;D:\Deleteme\test.docx&quot;) 
  $sel = $word.Selection
  $paras = $doc.Paragraphs
  
  $path = &quot;D:\deleteme\words.txt&quot;
  
  foreach ($para in $paras) 
  { 
      $para.Range.Text | Out-File -FilePath $path -Append
  }
  
  #Find all capitalized words :( Everything works except this. I want to extract all Capitalized words
  $capwords = Get-Content $path | Select-string -pattern &quot;/\b[A-Z]+\b/g&quot; 
  </code></pre>