I have a web form which has a field for users to enter a time. I need to have control over the format of the time, but for a few reasons, I can't give the user a dropdown box to pick from - they have to enter the time in a free form text box.
Is it possible to use wildcards for this? Basically, I want to convert all variations of 10 a.m. to exactly that, 10 a.m. Is it possible to keep it simple with something like this:
$SessionTime = $_GET['SessionTime'];
if ($SessionTime == "10*") {
$SessionTime == "10 a.m.";
}
Something like this would take all variations of 10 a.m. (10 am, 10am, 10 a.m, 10 am., 10 a,m. etc.) and convert them to 10 a.m.
Or do I need to get into regular expressions and pattern matching? I started reading a bit on regular expressions and that stuff just looks way more complicated than what is necessary for this.