Making regular expressions more friendly

Ian Clarke clarkeia at logica.com
Tue Oct 5 10:40:46 EDT 1999


I have never liked regular expressions, they seem to come from the Perl
school of programming (whose motto is "If nobody else `can understand my
code, they can never fire me!").  Of course, it is not actually the
regular expressions themselves that annoy me, it is the language they
are written in.

What if, instead of using '(hello)*' you could use 'multiple("hello")',
and other such long-winded replacements.  Yes, this would prevent people
from writing '(?P<m>\s*\d+/\d[-,\d]*/\d+,\s+[^,]+)(?P<u>.*' and then
giggling with glee as their co-workers scratch their heads over what the
hell this does, but that is a price I would be willing to pay.

Ian.




More information about the Python-list mailing list