Suggested change to simplify some regular expressions:
*** FAQ_4.72_before Mon Oct 11 18:07:09 2010
--- FAQ_4.72_after Mon Oct 11 18:09:57 2010
***************
*** 9,13 ****
if (/^[+-]?\d+$/) { print "is a +/- integer\n" }
! if (/^-?\d+\.?\d*$/) { print "is a real number\n" }
! if (/^-?(?:\d+(?:\.\d*)?|\.\d+)$/) { print "is a decimal
number\n" }
! if (/^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/)
{ print "a C float\n" }
--- 9,12 ----
if (/^[+-]?\d+$/) { print "is a +/- integer\n" }
! if (/^-?(?:\d+\.?|\.\d)\d*$/) { print "is a decimal
number\n" }
! if (/^[+-]?(?=\.?\d)\d*\.?\d*(e[+-]?\d+)?$/i)
{ print "a C float\n" }
The regex /^-?\d+\.?\d*$/ is deleted because it doesn't match
numeric strings like '.5' with no digits before the decimal point,
and is otherwise equivalent to the regex on the next line. The
other two regexes are simplified.
*** FAQ_4.72_before Mon Oct 11 18:07:09 2010
--- FAQ_4.72_after Mon Oct 11 18:09:57 2010
***************
*** 9,13 ****
if (/^[+-]?\d+$/) { print "is a +/- integer\n" }
! if (/^-?\d+\.?\d*$/) { print "is a real number\n" }
! if (/^-?(?:\d+(?:\.\d*)?|\.\d+)$/) { print "is a decimal
number\n" }
! if (/^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/)
{ print "a C float\n" }
--- 9,12 ----
if (/^[+-]?\d+$/) { print "is a +/- integer\n" }
! if (/^-?(?:\d+\.?|\.\d)\d*$/) { print "is a decimal
number\n" }
! if (/^[+-]?(?=\.?\d)\d*\.?\d*(e[+-]?\d+)?$/i)
{ print "a C float\n" }
The regex /^-?\d+\.?\d*$/ is deleted because it doesn't match
numeric strings like '.5' with no digits before the decimal point,
and is otherwise equivalent to the regex on the next line. The
other two regexes are simplified.