title: Expression to find multiple spaces in string
body: <p>We handle a lot of sensitive data and I would like to mask passenger names using only the first and last letter of each name part and join these by three asterisks (***), </p>
  
  <blockquote>
    <p>For example: the name 'John Doe' will become 'J***n D***e'</p>
  </blockquote>
  
  <p>For a name that consists of two parts this is doable by finding the space using the expression:</p>
  
  <pre><code>LEFT(CardHolderNameFromPurchase, 1) + 
   '***' + 
   CASE WHEN CHARINDEX(' ', PassengerName) = 0 
        THEN RIGHT(PassengerName, 1) 
        ELSE SUBSTRING(PassengerName, CHARINDEX(' ', PassengerName) -1, 1) +
             ' ' + 
             SUBSTRING(PassengerName, CHARINDEX(' ', PassengerName) +1, 1) +
             '***' + 
             RIGHT(PassengerName, 1) 
   END
  </code></pre>
  
  <p>However, the passenger name can have more than two parts, there is no real limit to it. How should can I find the indices of all spaces within an expression? Or should I maybe tackle this problem in a different way?</p>
  
  <p>Any help or pointer is much appreciated!</p>