Making regex suck less

Henrik Motakef henrik.motakef at web.de
Sun Sep 1 16:37:34 EDT 2002


gerson.kurz at t-online.de (Gerson Kurz) writes:

> So basically, couldn't one come up with a *human readable* syntax
> for re, and compile that instead? Python prides itself on its clean
> syntax, and human readability, an bang - import re, get perl-ish
> code instantly!

There is an Emacs Lisp package called "symbolic regexps" (or
sregexp.el) that lets you write regular expressions in standard lisp
syntax, like

(sregexq bol (or "abc" "def"))

instead of "^(abc|def)" (bol meaning "beginning of line"). I don't see
how that maps elegantly to Python syntax, however.

Regards
Henrik



More information about the Python-list mailing list