Meh, I couldn't sleep as I have a toothache. I knew I should have made a new appointment with the dentist when he cancelled my appointment in January but it's too late to regret that now. In any case, while lying in bed waiting for the Paracetamol to kick in I was pondering a SQL
problem I had at work this week and suddenly it hit me: doesn't MySQL have a regular expression parser I could use to solve the problem I had with selecting eventdates entered in a VARCHAR field?
And lo and behold it does: Tech-recipes: Use regular expressions in MySQL SELECT statements
contains the answer to my problems.
SELECT cursusdata, titel
will match a date like the 4th of March in a field like this: '19-2-2008, 4-3-2008, 11-3-2008' but will not match a field like '7-3-2008, 14-3-2008, 21-3-2008'. My current code uses some array checking to make sure I filter out the dates that aren't wanted like the 14th and removing these checks will reduce my code by about 7 lines, which makes the code a lot more readable.
Good stuff™, and the toothache has gone down a bit so I'm good to go off to bed again.