title: Using regular expression to validate colon separated inputs
body: <p>I'm reading in a file for a Java application which has data separated by colons in the format:</p>
  <pre class="lang-none prettyprint-override"><code>test : test : 0 : 0
  </code></pre>
  <p>Where the first two segments are names of something and the last two are digits.</p>
  <p>The match should fail if the input is not formatted in that exact way above (aside from the data being different)</p>
  <pre class="lang-none prettyprint-override"><code>test : test : 0 : 0 -----&gt; pass
  : test: 0 : 0       -----&gt; fail
  0 : test : 0 : test -----&gt; fail
  test test : 0 : 0   -----&gt; fail
  </code></pre>
  <p>So the match will fail if there are any segments omitted, if the digits and words do not appear where they should, i.e. <code>word : word : digit : digit</code>, and there has to be 3 colons and 4 segments no more no less as above.</p>
  <p>This is where I have gotten so far but it's not quite right:</p>
  <pre><code>^\D+(?:\s\:\s\w+)*$
  </code></pre>