Hey could someone help me to test if a string matches 3 double digit figures separated by a colon? For Example:
12:13:14
I understand I should be using preg_match but I can’t work out how
Preferably the first number should be between 0 and 23 and the second two numbers should be between 0 and 59 like a time but I can always work that out with if statements.
Thanks
You could use preg_match with number comparissons on
$string = '23:24:25';Or you can even ditch the regular expresions and use explode with numeric comparisons.