C++11 RegEx, non-greedy
<p>I have a little bit of a problem with a C++11 RegEx and I think it is about greedynes.</p>

<p>Here is a little sample.</p>

<pre><code>#include &lt;stdio.h&gt;
#include &lt;string&gt;
#include &lt;regex&gt;

int main (void)
{
  std::string in="{ab}{cd}[ef]{gh}[ij][kl]";  // the input-string

  std::regex rx1 ("(\\{.+?})(.*)", std::regex::extended);       // non-greedy?
  std::smatch match;

  if (regex_match (in, match, rx1))
  {
    printf ("\n%s\n", match.str(1).c_str());
  }

  return 0;
}
</code></pre>

<p>I would expect </p>

<pre><code>{ab} 
</code></pre>

<p>for output.
But I got </p>

<pre><code>{ab}{cd}[ef]{gh}
</code></pre>

<p>I would expect the result I get, if I do it greedy but not with the ? after the .+.
Should make it non-greedy, right?</p>

<p>So whats the problem in my idea?
Thanks for help!</p>

<p>Chris</p>