I\'ve spent half an hour trying to get this, maybe someone can come up with it quickly.
I need a regular expression that will match one or two digits, followed by an
you can use
let regex = new RegExp( ^(?=[0-9.]{1,${maxlength}}$)[0-9]+(?:\.[0-9]{0,${decimal_number}})?$ );
^(?=[0-9.]{1,${maxlength}}$)[0-9]+(?:\.[0-9]{0,${decimal_number}})?$
where you can decide the maximum length and up to which decimal point you want to control the value
Use ES6 String interpolation to wrap the variables ${maxlength} and ${decimal_number}.