lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


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