Determine if a string is numeric: Difference between revisions
Add ed example
(Add SmallBASIC) |
(Add ed example) |
||
Line 2,020:
→ YES
</syntaxhighlight>
=={{header|Ed}}==
<syntaxhighlight lang="sed">
H
g/^([-+]?[0-9]*)(\.[0-9]+([eE][+-]?[0-9]+)?)?$/s//\1\2 is numeric/
v/numeric/s/.*/& is not numeric/
,p
Q
</syntaxhighlight>
{{out}}
<pre>$ cat string-numeric.ed | ed -GlEs string-numeric.input
Newline appended
56233 is numeric
-315 is numeric
1.36 is numeric
-5.126 is numeric
3.7E-05 is numeric
1.23BC is not numeric
5.6.3 is not numeric</pre>
=={{header|Elixir}}==
|