//decima8to2
^(0(\.(0[1-9]|[1-9]\d{0,1}))|([1-9]\d{0,5}(\.\d{0,2})?))?$
This allows 0 values only when followed .01 or greater or any numbers beginning with 1-9 up to 6 digits total followed by optional decimal point + 1 or 2 digits
There's a slight difference between your code and the description.
allows
optional decimal point + 0 or 1 or 2 digits so 40.00 could be entered as 40
. or as 40 here.
The final ?$ also allows blank input. There's also a set of unnecessary brackets.
Suggest
^( 0(\.(0[1-9]|[1-9]\d{0,1})) | [1-9]\d{0,5}(\.\d{0,2})? )$
or
^( 0(\.(0[1-9]|[1-9]\d{0,1})) | [1-9]\d{0,5}(\.\d{1,2})? )$
If you want to allow people to type
.75 instead of 0.75 try:
^( 0?(\.(0[1-9]|[1-9]\d{0,1})) | [1-9]\d{0,5}(\.\d{1,2})? )$
Remove spaces before using.
Regular expressions give you an infinite number of very fine grained possibilities.