I have got an input mask as an array =
[/[0-5]/, /\d/, /\d/, ":", /[0-5]/, /\d/, ":", /[0-5]/, /\d/, ".", /\d/, /\d/, /\d/,]
It corresponds formatting for example - 344:43:43.565
The maximum allowed number for first fracture (where 344
is now) - is 596
I am able to set ranges for all fractures, but I cannot combine RegExp to match 596
as a maximum allowed fracture at the beginning.
So, the idea is to accept 589:43:43.565
but to cancel 597:43:43.565
input number (as 596
is max allowed for this portion of a fracture)
I've created a RegExp for whole time (as a string) -
/^(?:[0-9]|[1-9][0-9]|[1-4][0-9]{2}|5[0-8][0-9]|59[0-6]):([0-5][0-9])(:[0-5][0-9](?:[:]\d{1,3})?)?$/
But unable to combine single RegExp into mask
Your Regexp is too strict. Probably typing in the input is impossible? You would need to make more colons and digits optional. The easier solution might be to have 4 inlined inputs and hardcode the separators (:/.) on the page, between the inputs.