Vlad Ioan Topan

My playground

Python snippets (1)

leave a comment »

Apparently, Python 2.6 supports a max. of 100 named groups in regular expressions. It also doesn’t support constructs such as (?i:…), which makes it impossible to selectively mark groups as case insensitive in a regex with more than 100 groups. The performance penalty for making the complete regex case insensitive is enormous (roughly double running time), so the only solution to my problem (which involves searching for a large number of patterns, some of them case insensitive) appears to be linking to an external regex module, such as PCRE (which will require bindings for Python, as PCRE for example doesn’t have any (not any more, at least)), or implementing my own pattern searching library. This should be fun.

Advertisements

Written by vtopan

February 18, 2009 at 8:29 PM

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: