title: Regex to match many times
body: <p>I'm trying to match a type definition</p>
  
  <pre><code>def euro : t1 -&gt; t2 -&gt; t3 (and this pattern my repeat further in other examples)
  </code></pre>
  
  <p>I came up with this regex</p>
  
  <pre><code>^def ([^\s]*)\s:\s([^\s]*)(\s-&gt;\s[^\s]*)*
  </code></pre>
  
  <p>But while it matches <code>euro</code> and <code>t1</code> it</p>
  
  <ul>
  <li>then matches <code>-&gt; t2</code> rather than <code>t2</code></li>
  <li>fails to match anything with <code>t3</code></li>
  </ul>
  
  <p>I can't see what I am doing wrong, and my goal is to capture</p>
  
  <pre><code>euro t1 t2 t3
  </code></pre>
  
  <p>as four separate items, and what I currently get is </p>
  
  <pre><code>0: "def euro : t1 -&gt; t2 -&gt; t3"
  1: "euro"
  2: "t1"
  3: " -&gt; t3"
  </code></pre>