# To support positive/negative integer/float numbers, you could use a slightly modified regexp from http://stackoverflow.com/questions/385558/python-and-regex-question-extract-float-double-value:
importsys
def main():
importre
re_float =re.compile("""(?x)
^
[+-]?\ * # first, match an optional sign *and space*
( # then match integers or f.p. mantissas:
\d+ # start out with a ...
(
\.\d* # mantissa of the form a.b or a.
)? # ? takes care of integers of the form a
|\.\d+ # mantissa of the form .b
)
([eE][+-]?\d+)? # finally, optionally match an exponent