title: How to "pad" a variable-length string to have an aligned last column
body: <p>I have an input of the following format:</p>
  
  <hr>
  
  <pre><code>09:08:11        XXXXXXXXXXXXX  1.1.1.1          
  09:09:03        YYYYYYYY  2.2.2.2         
  09:12:37        ZZZZ   3.3.3.3
  </code></pre>
  
  <hr>
  
  <p>I am able to extract these individuals fields easily using the regex <code>/(\S+)\s+(\S+)\s+(\S+)\s+/</code>. I named them <code>$time</code>, <code>$name</code>, and <code>$number</code>. My problem is I want to display this so that the <code>$number</code> aligns perfectly. Because the <code>$name</code> can be of any length, what is the best solution for this?</p>
  
  <p>I would like for the output to look like this. Please note that I had to use dots to align the last field since I wasn't able use the spacebar to do this, not sure why. Anyhoo.</p>
  
  <hr>
  
  <pre><code>09:08:11        XXXXXXXXXXXXX    1.1.1.1          
  09:09:03        YYYYYYYY         2.2.2.2         
  09:12:37        ZZZZ             3.3.3.3
  </code></pre>
  
  <hr>
  
  <p>I thought about putting the <code>$name</code> into an array. And then use a function to find the one with the longest character count. Finally I would pad out the shorter name to match the longest name. Is there a better and more efficient way to do this?</p>