Anonymous user
Determine if a string is numeric: Difference between revisions
→{{header|Python}}
Line 3,855:
"inf" -> inf <class 'float'> is_numeric: True str.isnumeric: False
"-Infinity" -> -inf <class 'float'> is_numeric: True str.isnumeric: False</pre>
===Python: Regular expressions==
<lang python>import re
numeric = re.compile('[-+]?(\d+(\.\d*)?|\.\d+)([eE][-+]?\d+)?')
is_numeric = lambda x: numeric.fullmatch(x) != None
is_numeric('123.0')</lang>
=={{header|Quackery}}==
|