title: Weird regex match behavior. Is my regex wrong? Or is it a compiler error?
body: <p>I am doing some work using regex in C++, tried both the std::regex and boost:regex (1.58.0).</p>
  
  <p>And I am getting this weird matches. Here is the code:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;regex&gt;
  using namespace std;
  
  int main(int argv, const char* argc[])
  {
      regex log_line_regex_(".+\\s(.+)$");
      char* log_line = "06-29 18:20:08.938 1031 1099 D WifiStateMachine: processMsgConnect oo ModeState";
      smatch matches; 
      if (regex_match(std::string(log_line), matches, log_line_regex_))
      {
          std::cout &lt;&lt; "match: " &lt;&lt; log_line &lt;&lt; std::endl;
          unsigned i;
          for (i = 0; i &lt; matches.size(); i++)
          {
              std::cout &lt;&lt; "$" &lt;&lt; i &lt;&lt; ": " &lt;&lt; std::string(matches[i].first, matches[i].second) &lt;&lt; std::endl;
          }
      }
      return 0;
  }
  </code></pre>
  
  <p>The result is:</p>
  
  <pre><code>match: 06-29 18:20:08.938 1031 1099 D WifiStateMachine: processMsgConnect oo ModeState
  $0: 06-29 18:20:08.938 1031 1099 D WifiStateMachine: processMsgConnect oo ModeSt`
  $1: ModeSt`
  </code></pre>
  
  <p>See? The output is mangled :(
  As I said I tried with <code>boost 1.58.0</code> and <code>g++ (GCC) 4.9.2</code> both on Cygwin</p>
  
  <p><a href="http://ideone.com/S8q5oV" rel="nofollow">Compiled at Ideone also fails</a></p>
  
  <p>I find it weird that boost::regex fails at this simple regex. So is my usage wrong?</p>