[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Number patterns
- From: Dirk Laurie <dpl@...>
- Date: Tue, 7 Dec 2010 12:03:23 +0200
I'm writing an input checker for a non-Lua application. It makes
liberal use of positive F-format real numbers, e.g. 3, .1, 3., 3.1.
Can one do that with just one pattern, assuming whitespace already
trimmed?
"%d*%.?%d*" matches any string
"^%d*%.?%d*$" matches '.' and ''
"^%d+%.?%d*$" does not match .1
"^%d*%.?%d+$" does not match 3.
Dirk