Is it possible to give Regex a min Value? [closed]

Tags: ,

Hey I have a working regex that really does the job it should.

One thing I would like to add or change is that the min Value should be 00:01 not 00:00.

Here is the ReGex I am using: let regexTime = /^$|^(([01][0-9])|(2[0-3])):[0-5][0-9]$/;

Basically only Time from 00:00 to 23:59 is allowed. But I need to have it that it starts from 00:01.

Is this possible I guess I cant just stay that the last number must be over 1 because obviously 00:10 should also be possible.

Thanks for any advice!


Use a negative lookahead to prevent the 00:00 specific case:



Source: stackoverflow