I ask for an input from the user that should strictly follow this format: hh:mm:ss:ff
I use Regex to check:
bool isTimeOkay = Regex.IsMatch(timestamp_textbox.Text, @"[0-9][0-9]:[0-5][0-9]:[0-5][0-9]:[0-9][0-9]");
Sometimes it works, but sometimes it doesn't. For example:
00:70:00:00 gives False, which is correct.
00:00:00:ss gives False, which is correct.
00:00s:00:00 gives False, which is correct.
00:00:00:00xcx gives True, which is wrong.
a1sdd00:00:00:00 gives True, which is wrong.
I want it to strictly enforce that there should also be no stray characters before and after of the pattern. Please help me how, thank you!