You can't easily validate it with a regular expression alone. Maybe it's possible, but not worth the effort I'd say. Instead, try something like this (untested): if (preg_match('/^(\d{1,2}):(\d{1,2}):(\d{1,2})$/', trim($_REQUEST['time']), $matches) && $matches[1] < 24 && $matches[2] < 60 && $matches[3] < 60) { $valid_time = sprintf('%02d:%02d:%02d', $matches[1], $matches[2], $matches[3]); echo "<p>Valid time submitted: {$valid_time}</p>"; } else echo "<p>Time was invalid.</p>"; Code (markup):