I am looking for a regular expression with the following requirements:
I tried ^[1-9][0-9]*$
but it does work.
Use
^(?![0.]+$)\d{1,9}\.\d{2}$
See proof
Explanation
--------------------------------------------------------------------------------
^ the beginning of the string
--------------------------------------------------------------------------------
(?! look ahead to see if there is not:
--------------------------------------------------------------------------------
[0.]+ any character of: '0', '.' (1 or more
times (matching the most amount
possible))
--------------------------------------------------------------------------------
$ before an optional \n, and the end of
the string
--------------------------------------------------------------------------------
) end of look-ahead
--------------------------------------------------------------------------------
\d{1,9} digits (0-9) (between 1 and 9 times
(matching the most amount possible))
--------------------------------------------------------------------------------
\. '.'
--------------------------------------------------------------------------------
\d{2} digits (0-9) (2 times)
--------------------------------------------------------------------------------
$ before an optional \n, and the end of the
string