Subject: | lone . (decimal) considered a match for $RE{num}{real} |
perl -MRegexp::Common=number -e 'print "oops\n" if "." =~ /$RE{num}{real}/'
This was pointed out to me by Gunnar Hjalmarsson in a thread on <beginners@perl.org> where I was trying to convince them of the virtues of using Regexp::Common over hand-crafting their own solutions. Here is a slightly perlified version from Jeffrey Friedl's book which I also posted to that thread which also solves the original issue without the oops: /-?(?:\d+(?:\.\d*)?|\.\d+)/