Boy do REs ever suck sometimes...
quinn at seniti.ugcs.caltech.edu
Sat Oct 6 02:00:00 CEST 2001
>> On Friday 05 October 2001 16:45, Ignacio Vazquez-Abrams wrote:
>> > Here's the problem I'm having with REs. When I use an RE like '^[0-9]+$' it
>> > matches both '123' and '123\n'. How can I get it to not match the string
>> > with the newline?
Note that, for that particular RE, you are probably better off with the
It really depends on the data you're parsing, but I almost always prefer
either split, join, isdigit, replace, find, and my own functions or an actual
parser (hand coded in the past, but SPARK and mxTextTools look interesting) to
regexps. Generators should make parser-writing even more fun.
REs can work nicely for some tasks, but they definately have that "hammer that
makes everything look like a thumb" thing going on (see the scanf thread).
More information about the Python-list