title: Modify raw input to look like a bus timetable in specific format using regex?
body: <p>I'm trying to figure this out for quite some time already, but can't seem to find the solution that would work at once or in the way I prefer it.</p>
  
  <p>I have an input that looks like this:</p>
  
  <pre><code>0430
  0500 25 50
  0615 34 51
  0708 26 43
  </code></pre>
  
  <p>And I need to turn it into this:</p>
  
  <pre><code>04:30
  05:00,05:25,05:50
  06:15,06:34,06:51
  07:08,07:26,07:43
  </code></pre>
  
  <p>Since this is only part of the input and manually replacing everything isn't an option, my guess is that the best option is to go with regex.</p>
  
  <p>What needs to be done:</p>
  
  <ol>
  <li>Insert colon after the first two ciphers (something like <code>(^\d{2})</code> and then doing replace/substitution with <code>$1:</code>)</li>
  <li>Replace each space with comma + first two ciphers + colon.
  My idea was to capture group <code>(^\d{2}:)</code> and then replace all spaces with <code>,$1</code> (per each line), but I can't seem to find the way to do it.</li>
  </ol>
  
  <p>I use <a href="https://regex101.com/" rel="nofollow noreferrer">regex101.com</a> for doing it, so if you have any advice on how to do it, or where to do it (or even if regex isn't the way to do it, what other way would you recommend) any help would be appreciated.</p>
  
  <p>Thanks in advance!</p>