[BangPypers] Parse multi line with re module.

Gora Mohanty gora at mimirtech.com
Tue Jan 3 15:42:24 CET 2012


On Tue, Jan 3, 2012 at 8:07 PM, Gora Mohanty <gora at mimirtech.com> wrote:
> On Tue, Jan 3, 2012 at 8:03 PM, Pratap Chakravarthy <prataprc at gmail.com> wrote:
>> Hi Ganesh, may be you can try this out,
>>
>>> re.findall(r'Searching for OPUSH on([^\.\n\r]+)|Channel:([^\r\n]*)', str )
>
> Try:
>  re.findall(r'Searching for OPUSH on([^\.\n\r]+)|Channel:([^\r\n]*)',
> 'Searching for OPUSH on in all the wrong places' )

Mean no offence to you personally, but this thread should again be
a reason why regular expressions should be used sparingly, if at all,
and against well-validated input.

If one really wants regular expressions, Perl still beats any other
language that I have personally seen, especially when it comes
to Unicode input (here, be real dragons).

Regards,
Gora


More information about the BangPypers mailing list