scanf style parsing
Aahz Maruch
aahz at panix.com
Sun Sep 30 17:59:44 EDT 2001
In article <mailman.1001607930.24098.python-list at python.org>,
Skip Montanaro <skip at pobox.com> wrote:
>
>You'll generally never cook up complex regular rexpressions using
>incremental search because you have no convenient way to correct mistakes
>and retry, but you will use all the pieces and build up more complex stuff
>when you're programming Perl or Python. Making the leap from Emacs's
>old-style re's to POSIX-style re's as Perl and Python use now is fairly
>straightforward. Mostly it involves getting rid of backslashes and learning
>about {m,n}, \d, \s and other little shortcuts. (I still almost never use
>\d. My fingers just type [0-9] automatically.)
>
>maybe-the-best-argument-against-vi-ly, yr's
Actually, what I usually do with vi is open up another editor window to
write my regex and then cut'n'paste to the window where I'm doing real
work. That way I *do* have a convenient way to correct mistakes in
complex regexes. Here's a cutie:
:s/(\([0-9][0-9][0-9]\)) *\([0-9][0-9][0-9]-[0-9][0-9][0-9][0-9]\)/\1-\2/
--
--- Aahz <*> (Copyright 2001 by aahz at pobox.com)
Hugs and backrubs -- I break Rule 6 http://www.rahul.net/aahz/
Androgynous poly kinky vanilla queer het Pythonista
We must not let the evil of a few trample the freedoms of the many.
More information about the Python-list
mailing list