[Tutor] Symbol re question
Lloyd Kvam
lkvam@venix.com
Tue, 18 Sep 2001 13:39:51 -0400
You want "^[0-9]+$" for your regular expression ^ from the beginning $ to the end.
robert frank brenart wrote:
>
> Alright, this should be easy and it's being a pain... I just want to find
> out if my string is all numbers.
>
> So I run...
> if ((re.match("[0-9]+", mystring)) != None):
> print "Pass"
> else:
> print "Fail"
>
> But that matches things like 10:45 and 3f, which I don't want it
> to. What'm I overlooking?
>
> -Rob
>
> _______________________________________________
> Tutor maillist - Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
--
Lloyd Kvam
Venix Corp.
1 Court Street, Suite 378
Lebanon, NH 03766-1358
voice: 603-443-6155
fax: 801-459-9582