title: Using a wildcard to replace CSV cell contents with PowerShell
body: <p>I'm trying to get PowerShell to manipulate some CSV data.</p>
  
  <p>The column I’m trying to manipulate in my CSV contains stock levels as text, containing mostly "High", "Good", "Medium", "Low" and "Out Of Stock" which I want to convert to a numerical format before importing the CSV to the website at the end of the day.</p>
  
  <p>My code currently is:</p>
  
  <pre><code>#Declare Stock Level Words To Value
  $StockLevelWordToValue = @{
      "High" = "70"
      "Good" = "50"
      "Medium" = "30"
      "Low" = "10"
      "Out Of Stock" = "0"
  }
  
  # import the CSV file
  $csv = Import-Csv "C:\temp\temp.csv";
  
  # for each row, replace the Stock Level Word field with a value
  foreach($row in $csv) {
      $row."Stock Level" = $StockLevelWordToValue[$row."Stock Level"];
  }
  
  # export the modified CSV
  $csv | Export-Csv "C:\temp\temp2.csv" -NoTypeInformation;
  </code></pre>
  
  <p>The problem I have is in my "Stock Level" column, some of the entries are like "Good: Last update August 2019" or “High: Last update March 2019”</p>
  
  <p>Currently, when running this code, there is no value returned for these entries and the cell is blank.</p>
  
  <p>I was hoping a wildcard would work like:</p>
  
  <pre><code>"Good*" = "50"
  </code></pre>
  
  <p>But that returns a blank cell too.</p>
  
  <p>How can check a cell "contains" a word and returns a numerical value, no matter what other words are in that cell?</p>