[BangPypers] Parse multi line with re module.

Pratap Chakravarthy prataprc at gmail.com
Tue Jan 3 16:49:51 CET 2012


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".

And I still beg to differ /

Cheers,

On Tue, Jan 3, 2012 at 8:53 PM, Gora Mohanty <gora at mimirtech.com> wrote:
> On Tue, Jan 3, 2012 at 8:31 PM, Pratap Chakravarthy <prataprc at gmail.com> wrote:
>>> Mean no offence to you personally,
>>
>> None taken.
>
> Thank you for taking things in a good spirit: Personally speaking,
> I discover almost each day how ignorant I am compared to other
> people, in many contexts. True knowledge should be the progressive
> discovery of one's ignorance.
>
>>                    I believe Ganesh might take your more specific regex and
>> use that with findall() grouping to get what he wants. It is always a
>> good practice to be more specific in composing regular expressions,
>> carelessly composed PCRE (where P stands for Perl ;) ) regex can lead
>> to exponential complexity for simple inputs.
>
> Um, that "exponential complexity" is *exactly* the problem.
>
> Regular expressions are extremely powerful, and can and
> maybe should be used in the right context. I presume that
> everyone has read Jamie Zawinski's rants about regular
> expressions.
>
> I wish that I could find again the story of someone, whose boss
> barely looked at his regular expression that spanned half-a-screen,
> and said that "you have a bug". The (obviously talented)
> developer spent over a day finding edge-cases, and went back
> to his boss, and said: "You are right, but please tell me how
> you could tell at a glance". Boss' answer was that he did not
> actually know that there was a bug, but the use of a regular
> expression of that size pretty much assured him that there
> would be one.
>
> As someone said in another context (about C++), when
> regular expressions are your only tool, every problem
> looks like your thumb.
>
>>> but this thread should again be a reason why regular
>>> expressions should be used sparingly, if at all,
>>> and against well-validated input.
>>
>> Really ?
>> I beg to differ.
>
> *Really?* I believe that the ball is currently in your court.
> It was *your* regex that was broken, and badly, if I may
> add.
>
> Regards,
> Gora
> _______________________________________________
> BangPypers mailing list
> BangPypers at python.org
> http://mail.python.org/mailman/listinfo/bangpypers



-- 
Pratap.


More information about the BangPypers mailing list