Re: a little parsing challenge ☺

rusi rustompmody at gmail.com
Sun Jul 17 07:52:25 EDT 2011


On Jul 17, 4:34 pm, Chris Angelico <ros... at gmail.com> wrote:
> On Sun, Jul 17, 2011 at 5:47 PM, Xah Lee <xah... at 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.



More information about the Python-list mailing list