title: Regular expressions and nested patterns : what's the definitive answer?
body: <p>This <a href="https://stackoverflow.com/questions/133601/can-regular-expressions-be-used-to-match-nested-patterns">question and its answers</a> here suggest that both:</p>
  
  <ol>
  <li><p>It is possible to use regex to match nested patterns. </p></li>
  <li><p>And that it is not possible, because nested patterns are not regular languages and
  therefore DFAs (which regex are) cannot recognize them.</p></li>
  </ol>
  
  <p>Before reading an answer (<a href="https://stackoverflow.com/a/3851098/2876289">https://stackoverflow.com/a/3851098/2876289</a>) to the above question, I would always side with 2. Now however I'm not so sure. </p>
  
  <p>Can <code>'/(\((?&gt;[^()]+|(?1))*\))/'</code></p>
  
  <p>really match nested patterns?</p>
  
  <p>That being asked - I tried the above in vim (and JavaScript) and it doesn't work. Though perhaps it needs to be converted to a different syntax. The answer quoting it has 9 upvotes.</p>