title: Regular Expressions misunderstanding or just broken implementation?
body: <p>I tried a very simple use of <code>regex_search</code> and can not understand why I do not get a match:</p>
  
  <p>Alas, the gcc-C++0x-implementations 4.5 does not seem to be working, I get a link error <a href="http://ideone.com/LY7hc" rel="nofollow">here</a>.</p>
  
  <p>But here is my gcc-4.7.0 try, quite straightforward:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  #include &lt;regex&gt;
  using namespace std;
  int main () {
      regex rxWorld("world");
      const string text = "hello world!";
      const auto t0 = text.cbegin();
      smatch match;
      const bool ok = regex_search(text, match, rxWorld);
      /* ... */
  }
  </code></pre>
  
  <p>I think I should get <code>ok==true</code> <em>and</em> something in <code>match</code> as well. I reduced the example to a very simple regex for this. I tried slightly more complicated first.</p>
  
  <p>But by printing code at <code>/* ... */</code> says otherwise:</p>
  
  <pre><code>  cout &lt;&lt; "  text:'" &lt;&lt; text
         &lt;&lt; "' ok:" &lt;&lt; ok
         &lt;&lt; " size:" &lt;&lt; match.size();
    cout &lt;&lt; " pos:" &lt;&lt; match.position()
         &lt;&lt; " len:"&lt;&lt; match.length();
    for(const auto&amp; sub : match) {
        cout &lt;&lt; " ["&lt;&lt;(sub.first-t0)&lt;&lt;".."&lt;&lt;(sub.second-t0)
             &lt;&lt; ":"&lt;&lt;sub.matched
             &lt;&lt; "'"&lt;&lt;sub.str()
             &lt;&lt; "']";
    }
    cout &lt;&lt; endl;
  </code></pre>
  
  <p>The output is:</p>
  
  <pre><code>$ ./regex-search-01.x
  text:'hello world!' ok:0 size:0 pos:-1 len:0
  </code></pre>
  
  <p><em>Update: I also tried <code>regex_search(t0, text.cend(), match, rxWorld)</code> and <code>const char* text</code>, no change.</em>
  `</p>
  
  <p><strong>Is my understanding of <code>regex_search</code> wrong?</strong> I am completely baffled. Or is it just the gcc?</p>