Problem
I am trying to achieve a regular expression which matches [0-9]:[0-9] or [0-9].[0-9] or [0-9] or [0-9]: or [0-9].
What I have tried
/^\d?(\d+)?((\.|\:|\d)$|(\.|\:|\d)(\d+)?\d$)/ This regex which is satisfying my condition.
My optimized code
\d+[\.:]*\d* But this is accepting 2:2:. Actually it should not. Not able to solve this.
^\d+(?:[.:]\d*)?$, see demo.