title: c++11 regex back references
body: <p>I don't manage to use back references in regular expression in c++.
  After trying more esoteric things, I tried this simple script on gcc 4.8.1:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;regex&gt;
  #include &lt;string&gt;
  
  using namespace std;
  
  int main() {
      regex e("(..)\\1");
      string s("aaaa");
      if (regex_match(s,e))
          cout &lt;&lt; "match" &lt;&lt; endl;
      return 0;
  }
  </code></pre>
  
  <p>but it produces a runtime error. I tried various flags in regex_constants like <code>ECMAScript</code> or <code>grep</code> but to no avail. What's wrong with this way of using back references in C++ regex engine?</p>
  
  <p>Just to make sure I was not missing something trivial, I tried this in Java</p>
  
  <pre><code>class TestIt
  {
      public static void main (String[] args) throws java.lang.Exception
      {
          final String s = "aaaa";
          final String e = "(..)\\1";
          if (s.matches(e))
              System.out.printf("match");
      }
  };
  </code></pre>
  
  <p>and obviously it prints <code>match</code> as expected, which is reassuring.</p>