Welcome Guest, Not a member yet? Register   Sign In
RegEx trouble
#1

[eluser]Fabdrol[/eluser]
Hi folks

I'm checking a date string in the foll format, generated by js and put in a form field:
Code:
YYYY-MM-DD HH:II

I cannot use form_valid lib on this, so I need to check it myself. To do so I have the following preg_match:
Code:
if(preg_match("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2})", $start) !== false) {
// do stuff
}
But somehow I can't recreate a 'wrong' situation. Is this a correct RegEx for checking this? I'm really bad at RexExes....

Thnks in advance


Messages In This Thread
RegEx trouble - by El Forum - 01-29-2010, 06:27 AM
RegEx trouble - by El Forum - 01-29-2010, 06:58 AM
RegEx trouble - by El Forum - 01-29-2010, 07:42 AM
RegEx trouble - by El Forum - 01-29-2010, 07:58 AM



Theme © iAndrew 2016 - Forum software by © MyBB