RegEx for matching brackets
George Sakkis
george.sakkis at gmail.com
Thu May 1 21:13:22 EDT 2008
On May 1, 7:44 pm, NevilleDNZ <neville... at gmail.com> wrote:
> Below is a (flawed) one line RegEx that checks curly brackets (from
> awk/c/python input) are being matched. Is there a one liner for doing
> this in python?
There is not even a 1000-liner regular expression for this; it's a
context-free language [1], not a regular one [2]. Either do it
manually or use a parser generator [3].
George
[1] http://en.wikipedia.org/wiki/Context-free_language
[2] http://en.wikipedia.org/wiki/Regular_language
[3] http://wiki.python.org/moin/LanguageParsing
More information about the Python-list
mailing list