RegExp, Python and strings

Matthias Huening matthias.huening at univie.ac.at
Sat Jan 8 09:23:47 EST 2000


Hi,
I'm new to PYTHON and I am trying to find out if PYTHON is the right
language for work with strings (which is what I need most). Therefore
I am playing around with the RE-module.

In PERL I can do things like this (in one line):
$A = "Rossum, Guido van; Harms, Daryl; Python, Franz-Josef";
$A =~ s/([A-Z])[\w]+(?![ \w\-]+,)([ ;-]|$)/$1.$2/g;
This RegExp results in: "Rossum, G. van; Harms, D.; Python, F.-J."

Now I am trying to rebuild this in PYTHON, but I can't get it to work.
Any hints? Should I keep trying? Or should I stick to PERL for those
kinds of string-manipulations?

Matthias

- - - - -
matthias.huening at univie.ac.at
http://www.ned.univie.ac.at/






More information about the Python-list mailing list