Perl-python regex-performance comparison
google at mrabarnett.plus.com
Tue Mar 3 22:23:09 CET 2009
Chris Rebert wrote:
> On Tue, Mar 3, 2009 at 9:05 AM, Ivan <ivan at invalid.net> wrote:
>> Hello everyone,
>> I know this is not a direct python question, forgive me for that, but
>> maybe some of you will still be able to help me. I've been told that
>> for my application it would be best to learn a scripting language, so
>> I looked around and found perl and python to be the nice. Their syntax
>> and "way" is not similar, though.
>> So, I was wondering, could any of you please elaborate on the
>> following, as to ease my dilemma:
>> 1. Although it is all relatively similar, there are differences
>> between regexes of these two. Which do you believe is the more
>> powerful variant (maybe an example) ?
> I would think that either they're currently equal in power or Perl's
> are just slightly more powerful, as pretty much all languages have
> basically copied Perl's regular expressions almost exactly. If you're
> talking about Perl6, then combined with the new "rules" feature it's
> much more powerful; however, like Perl's regular expressions, someone
> will probably write a library like pcre that implements it for all
> other languages, so it'll probably just be a matter of syntax.
Python 2.7's regex will include possessive quantifiers, atomic groups,
variable-length lookbehinds, and Unicode properties (at least the common
ones), amongst other things.
More information about the Python-list