[eluser]Jay Logan[/eluser]
Not really a CI related issue but maybe someone is willing to help.
I'm trying to make a callback function to validate user input of a time. Some example valid times would be:
19.26
12:34.55
1:47:23.55
Some invalid times would be:
61.92
2904.234
26:34:66
The code I use will only return TRUE if the input pattern is similar to 22:43.45. Here is what I have.
Code:
function seed_check($seed)
{
if (preg_match("/^[0-5]{1}[0-9]{1}:[0-5]{1}[0-9]{1}.[0-5]{1}[0-9]{1}$/", $seed))
{
return TRUE;
} else {
$this->form_validation->set_message('seed_check', 'You entered a seed time in an incorrect format. Your input input should be similar to MM:SS.LL');
return FALSE;
}
}