[Python-Dev] Urgent: regex Perl vs Python

Guido van Rossum guido@python.org
Wed, 02 Oct 2002 17:34:00 -0400


> > It is said that with the new re module, Python "has the regular
> > expressions like Perl".
> > Can somebody tell me to what extent this is true?
> > I need to convince s.o. not to use Perl for a larger project,
> > but I cannot answer the question up to which version the
> > Python re's are covering all of Perl's?
> 
> Please, can somebody give me just a version number?
> I really need this info, and I'm not intending
> to start a thread, I sware.

Nobody knows, Chris.  We started with Perl regexes as they were in
Perl version 5.x (for some low value of x that nobody remembers),
threw out everything that Python couldn't implement (like references
to variables with $name), threw away a few things that we felt were
only present for Perl 4 backwards compatibility (like some of the
ambiguity between octal character references and backreferences), and
added some Python specific features like named groups.  Hardly any new
Perl regex features were added, but I can't guarantee that we didn't
add anything.

Your best bet is to compare the reference docs for Python and Perl
regexes.

--Guido van Rossum (home page: http://www.python.org/~guido/)