I'm Sure There's A Better Way

Alex Martelli aleaxit at yahoo.com
Sun Jul 8 03:40:21 EDT 2001

"Bengt Richter" <bokr at accessone.com> wrote in message
news:3b478576.1314346961 at wa.news.verio.net...
> >> dollar amount.  Which means it follows these rules:
> >>
> >> First character is numeric or "-"
> >This is very easy to express as a Regular Expression:
> >    r'-?\d+(\.\d\d)?$'
> or
>      r'^-?(\d*\.\d\d|\d+)$'
> if you want to allow .12  (or -.00), see below ;-)

Yes, but that follows a very different spec from the one
given by the original poster, where the first rule was, as
above quoted, 'first character is numeric or "-"'.

Getting the specs 'right' for a fuzzily defined domain is
challenging, I was just trying to help implement the
specs the poster thought were right:-).


More information about the Python-list mailing list