[BangPypers] Parse multi line with re module.

Pratap Chakravarthy prataprc at gmail.com
Tue Jan 3 17:28:48 CET 2012


I donno guru. You ask the question.

> please come up with a real-life example.

And provide the answer in your final paragraph.

> I believe that we are
> now in an age where intelligent parsers
> should be able to derive meaning from
> broken, and incomplete structures.

The only way I know to write a parser is using regular expressions,
whether parser it is intelligent or not.

> Again, forgive me,
> but this smells of intellectual laziness to me.

Totally true. Except for going back and checking whether my suggested
regex has exponential complexity I am just doing cut and paste work
here ;)

On Tue, Jan 3, 2012 at 9:43 PM, Gora Mohanty <gora at mimirtech.com> wrote:
> On Tue, Jan 3, 2012 at 9:19 PM, Pratap Chakravarthy <prataprc at gmail.com> wrote:
>> The ball is in my court alright. But you have played my turn as well, with your
>> explanations, and you played it good. Except for the paragraph about the
>> boss. I only beg to differ from your suggestion "... used sparingly, if at
>> all used".
>
> OK, let's stop complimenting each other, and start challenging each other.
>
>> And I still beg to differ /
>
> OK, as you admit that the ball is in your court :-)
> please come up with a real-life example.
>
> I am not sure how to set up a comparison,
> but my contention is that in cases of
> uncontrolled input, regexs invariably break.
> The OP's case of parsing logs ideally is a
> case for regular expression, *provided* that
> the format of the logs is fixed.
>
> Regular expressions are entirely too rigid,
> for the most part. I believe that we are
> now in an age where intelligent parsers
> should be able to derive meaning from
> broken, and incomplete structures. After
> all, humans do the same, without hardly
> even thinking.
>
> Regards,
> Gora
> _______________________________________________
> BangPypers mailing list
> BangPypers at python.org
> http://mail.python.org/mailman/listinfo/bangpypers



-- 
Pratap.


More information about the BangPypers mailing list