regular expressions questions

Neel Krishnaswami neelk at
Wed Mar 29 02:29:20 CEST 2000

Andrew M. Kuchling <akuchlin at> wrote:
> Derek Thomson <derek at> writes:
> >
> > I'm sure a decent syntax could be devised with a little
> > thought. After all, the named subexpression idea is very good, and
> > a great improvement over Perl's numbering system ie $1, $2 etc.
> Suggestions would be welcomed, and could rescue the idea from
> oblivion.  Feel free to post a proposed syntax; we can then refine it
> through further discussion.

I think that Greg Ewing has the right idea with Plex; strings should
be for strings, not for encoding a regular expression in. We have a
perfectly good language -- Python -- for expressing data structures
in. Trying to encode regexps in a seperate sublanguage will just grow
escape sequences without bound, because the set of characters that can
be part of a string overlaps with the characters that denote regexp

  x = Str("[foo]", "(bar)")

is simpler than the crazy nest of quoting that is

  x = re.compile(r"(\[foo\])|(\(bar\))")

and it gets relatively simpler as the complexity of the regexp goes


More information about the Python-list mailing list