[BangPypers] Parse multi line with re module.

Gora Mohanty gora at mimirtech.com
Tue Jan 3 17:13:05 CET 2012


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


More information about the BangPypers mailing list