You are not logged in.
Pages: 1
Can anyone enlighten me as to why the below regex in PHP doesn't match this string and set $IS_TZ to true?
2 FEB 2009
if (preg_match('^(0?[1-9]|[1-2][0-9]|3[0-1])[- /.](JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC)[- /.](19|20)?[0-9]{2}$', $TZ)) $IS_TZ = true;I'm also open to better ways to validate a timestamp in PHP?
![]()
Last edited by fukawi2 (2009-02-05 21:24:42)
Are you familiar with our Forum Rules, and How To Ask Questions The Smart Way?
BlueHackers // fscanary // resticctl
Offline
Hmm, am I wrong or does your regex miss the delimiters i.e:
preg_match('#[regex]#', $foo)Offline
Obviously I'm still learning Regex... I didn't know PHP required those delimiters... It works now, thanks chimeric ![]()
I'll read up on those delimiters.
Are you familiar with our Forum Rules, and How To Ask Questions The Smart Way?
BlueHackers // fscanary // resticctl
Offline
Pages: 1