title: Update a string to follow a specific format
body: <p>I have a column in my database that stores a string of numbers, separated by commas.</p>
  
  <pre><code>,,133,,,,444,,,,555,,,,6,
  </code></pre>
  
  <p>Rules:</p>
  
  <ul>
  <li>The first number in the string is always preceded by 2 commas</li>
  <li>There are always 4 commas between the middle numbers</li>
  <li>The last number only has 1 comma after it</li>
  </ul>
  
  <p>The example above is how I always want the string to look..</p>
  
  <p>What happens is when some of these numbers are removed the updated string looks like this:</p>
  
  <pre><code>,,31,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,998,,,,476,,,,,
  </code></pre>
  
  <p>Making it look messy in the database and sometimes causing trouble with the extra commas when I try to output each number</p>
  
  <p>I've been manually updating each value to follow the format I want but I'd like to make a script that runs each night and takes each of these strings and updates them with the correct format following the rules I listed above.</p>
  
  <p>What can I use to format the string to follow the rules above?</p>