On Jul 17, 4:34 pm, Chris Angelico <ros...@gmail.com> wrote: > On Sun, Jul 17, 2011 at 5:47 PM, Xah Lee <xah...@gmail.com> wrote: > > the problem is to write a script that can check a dir of text files > > (and all subdirs) and reports if a file has any mismatched matching > > brackets. > > I wonder will it be possible to code the whole thing as a single > regular expression... I'm pretty sure it could be done as a sed or awk > script, but I'm insufficiently expert in either to do the job. > > ChrisA
No possible: See http://en.wikipedia.org/wiki/Pumping_lemma_for_regular_languages#Use_of_lemma Informally stated as regexes cant count. -- http://mail.python.org/mailman/listinfo/python-list