Which regex syntax mode?

Tim Hammerquist tim at degree.ath.cx
Sat Sep 16 18:34:04 EDT 2000


Tim Peters <tim_one at email.msn.com> wrote:
> > and was wondering with RegExp syntax mode was most like Perl's syntax?
> 
> Probably the awk variant, but forget you asked that:  the "regex" module has
> been obsolete for years, and will probably go away someday.  Use the "re"
> module instead:  its syntax is a nearly exact clone of Perl5's regexp
> syntax.  So you'll feel much more at home with that.

Thank you.  I'm reading O'Reilly's Programming Python, based on Python
1.3, so it only mentions regex and regsub.  I'm glad I asked.  =)

> You're in for a bit of culture shock, though.  There's nothing special about
> regular expressions in Python:  they're just another kind of object,
> supplied by just another module, and the language proper knows nothing about
> them.  Native Python programmers use regexps about as often as native Perl
> programmers actually use Perl OO <0.9 wink>.

I also come from C++, and welcome Python's true OO capabilities.  Regex
are often overused, granted.  But when they're only only option, they're
invaluable.

Thank you all.  =)
-- 
-Tim Hammerquist <timmy at cpan.org>
You know, we've got armadillos in our trousers.
It's really quite frightening.
	-- Nigel Tufnel, "This is Spinal Tap"



More information about the Python-list mailing list