Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Matching nested parens is exceedingly simple using modern patterns. Not counting whitespace, this sort of thing: </p> <pre><code>\( (?: [^()] *+ | (?0) )* \) </code></pre> <p>works for mainstream languages like Perl and PHP, plus anything that uses PCRE.</p> <p>However, you really need <strong>grammatical regexes</strong> for a full parse, or you’ll go nuts. Don’t use a language whose regexes don’t support breaking regexes down into smaller units, or which don’t support proper debugging of their compilation and execution. Life’s too short for low-level hackery. Might as well go back to assembly language if you’re going to do that.</p> <p>I’ve written about recursive patterns, grammatical patterns, and parsing quite a bit: for example, see <a href="https://stackoverflow.com/questions/4840988/the-recognizing-power-of-modern-regexes/4843579#4843579">here for parsing approaches</a> and <a href="https://stackoverflow.com/questions/4231382/regular-expression-pattern-not-matching-anywhere-in-string/4234491#4234491">here for lexer approaches</a>; also, the <a href="https://stackoverflow.com/questions/4246077/simple-problem-with-regular-expression-only-digits-and-commas/4247184#4247184">final solution here</a>.</p> <p>Also, Perl’s <a href="http://search.cpan.org/~dconway/Regexp-Grammars/lib/Regexp/Grammars.pm" rel="nofollow noreferrer"><code>Regexp::Grammars</code> module</a> is especially useful in turning grammatical regexes into parsing structures.</p> <p>So by all means, go for it. You’ll learn a lot that way.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload