[Python-ideas] New pattern-matching library (was: str.split with multiple individual split characters)

Nick Coghlan ncoghlan at gmail.com
Mon Feb 28 23:18:43 CET 2011


On Tue, Mar 1, 2011 at 3:15 AM, Guido van Rossum <guido at python.org> wrote:
> On the third hand, I could see this as an area where a pure
> library-based approach will always be doomed, and where a proposal to
> add new syntax would actually make sense. Of course that still has the
> same problems due to release time and policy.

I suspect one of the core issues isn't so much that regex syntax is
arcane, ugly and hard to remember (although those don't help), but the
fact that fully general string pattern matching is inherently hard to
remember due to the wide range of options. There's a reason glob-style
matching is limited to a couple of simple wildcard characters.

As as code based alternatives to regexes go, the one I see come up
most often as a suggested, working, alternative is pyparsing (although
I've never tried it myself). For example:
http://stackoverflow.com/questions/3673388/python-replacing-regex-with-bnf-or-pyparsing

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia



More information about the Python-ideas mailing list