title: C++ regex split after first whitespace
body: <p>I have a string as follows:</p>
  
  <pre><code>{ &lt;object&gt; waves   ;              big    yellow       flowers ;          slugs       ; }
  </code></pre>
  
  <p>And I need to come up with a correct regex to split it after the first white space, then after that only by the semicolons so that in a vector, it would look as follows:</p>
  
  <pre><code>s.at(0) = &lt;object&gt;
  s.at(1) = waves
  s.at(2) = big yellow flowers
  s.at(3) = slugs
  </code></pre>
  
  <p>The closest I've come to is just splitting it by the semicolons, but <code>&lt;object&gt;</code> and waves end up being read as one line.</p>
  
  <p>Edit: This is the split function I'm using</p>
  
  <pre><code>vector&lt;string&gt; split(const string &amp;input, const string &amp;regex, bool delim = true) {
  std::regex re(regex);
  
  std::sregex_token_iterator first, last;
  if (delim) {
      first = sregex_token_iterator{input.begin(), input.end(), re};
  } else {
      // the -1 removes the delimiter
      first = sregex_token_iterator{input.begin(), input.end(), re, -1};
  }
  return vector&lt;string&gt;(first, last);
  }
  </code></pre>