title: C++ 11 regex stack overflow / VS2012
body: <p>I'm in the process of converting some older Boost regex code to C++11, and I stumbled upon an issue with one of my test cases.  Here is a scenario which causes a stack overflow exception using std::regex, but worked fine with boost::regex.  I have not changed the regular expression pattern, and have verified the pattern is what I want.  It seems this particular string input fragment is causing the stack overflow.  Using VS2012, x64 debug build:</p>
  
  <pre><code>std::regex regx( "(^|\\})(([^\\{:])+:)+([^\\{]*\\{)" );
  
      const std::string testinput = " COLOR: #000; BACKGROUND-COLOR: #FFF; FONT-FAMILY: VERDANA, ARIAL, HELVETICA, SANS-SERIF; BACKGROUND:URL(URL(___FOO___)); BACKGROUND-2:URL(URL(___FOO___)); BORDER: 0 0 0 0; BORDER-2: 0 0 0; BORDER-3: 0 0; BORDER-4: 0PX; BORDER-5: 0.6; FILTER:PROGID:DXIMAGETRANSFORM.MICROSOFT.ALPHA(OPACITY=100); } ";
      std::smatch what;
      // this next line causes a stack overflow
      std::regex_search( testinput.cbegin(), testinput.cend(), what, regx );  
  </code></pre>
  
  <p>Looking at the call stack after the exception, there seems to be some type of infinite recursion going on in the regex implementation.  I don't currently have GCC to test this with.  What am I doing wrong? </p>
  
  <p>Update:
  After the suggestions below, I pasted this code into a console app, VS 2012 x64 debug and I get the stack overflow.  If I change it to x64 release, or Win32 debug or release it runs fine.  Huh??? Do i need to reinstall VS and/or the platform SDK?  I'm on Win7 x64.</p>
  
  <p>Update #2:
  Somewhat related post:  <a href="https://stackoverflow.com/q/12828079/882436">Why does std::regex_iterator cause a stack overflow with this data?</a>
  I suppose if I rewrite my regex, it might help.  I'm still not sure why the bitness matters though.  And why it works for others, but not for me on my system.  Sigh.</p>