title: How to use a conditional statement with regex in PowerShell?
body: <p>There are about ten lines of data.  For each line of data I want to indicate whether that line contains numerals.</p>
  
  <p>How can I print out "yes, this line has numerals" or "no, this line has no numerals" for each and every line, exactly once?</p>
  
  <p>output:</p>
  
  <pre><code>thufir@dur:~/flwor/csv$ 
  thufir@dur:~/flwor/csv$ pwsh import.ps1 
  no digits
  
  Name
  ----                                                                           
  people…                                                                        
  
  thufir@dur:~/flwor/csv$ 
  </code></pre>
  
  <p>code:</p>
  
  <pre><code>$text = Get-Content -Raw ./people.csv
  [array]::Reverse($text)
  
  $tempAttributes = @()
  $collectionOfPeople = @()
  
  ForEach ($line in $text) { 
    if($line -notmatch '.*?[0-9].*?') {
      $tempAttributes += $line 
      Write-Host "matches digits"   
    }
    else {
      Write-Host "no digits"   
      $newPerson = [PSCustomObject]@{
        Name       = $line
        Attributes = $tempAttributes
      }
      $tempAttributes = @()
      $collectionOfPeople += $newPerson
    }
  }
  
  $collectionOfPeople
  </code></pre>
  
  <p>data:</p>
  
  <pre><code>people
  joe
  phone1
  phone2
  phone3
  sue
  cell4
  home5
  alice
  atrib6
  x7
  y9
  z10
  </code></pre>
  
  <p>The only reason I'm printing "digits" or "no digits" is as a marker to aid in building the object.</p>