title: JavaScript RegEx Syntax Error
body: <p>I have created the following Regular Expression in C# to extract tokens from a string in the format {token}. I developed the regex in C# and confirmed that it works.</p>
  
  <pre><code>// c#
  var regex = new Regex(
      "\\{ (?&gt;[^{}]+| \\{ (?&lt;number&gt;) | \\} (?&lt;-number&gt;) )*(?(number)(?!))\\}",
      RegexOptions.IgnoreCase | RegexOptions.CultureInvariant | 
      RegexOptions.IgnorePatternWhitespace | RegexOptions.Compiled);
  
  var matches = regex.Matches("blah {token1} blah blah  blah {token2} blah");
  </code></pre>
  
  <p>The variable <code>matches</code> ends up containing two matches - "{token1}" and "{token2}".</p>
  
  <p>I need to execute this in JavaScript, but I get a Syntax error in the expression when I try to execute the following line...</p>
  
  <pre><code>// JavaScript
  var regex = new RegExp("\\{ (?&gt;[^{}]+| \\{ (?&lt;number&gt;) | \\} (?&lt;-number&gt;) )*(?(number)(?!))\\}");
  </code></pre>
  
  <p>Is there anything obvious that I am doing wrong?<br>
  Am I trying to use RegEx features that are not supported in JavaScript?</p>