date validation.

FlyBoy

Well-known member
Joined
Sep 6, 2004
Messages
106
i have the following date vaidation regex pattern:
[0-3]\d-(JAN|FEB|
MAR|APR|MAY|JUN|J UL|
AUG|SEP|OCT|NOV|D EC)
-\d{4}

i now its fine...i think that the days pattern is somewhat wrong isnt it?
i mean you can enter nubers bigger then 31 right?
so any idea how to fix it????
 
It would also match 00 as the day and allow some unrealistic years (actually depends what you are doing. Anyway show how to only allow year 19xx or 20xx)

Code:
(0[1-9]|[12][0-9]|3[01])-(JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC)-(19|20)\d\d
 
John_0025 said:
It would also match 00 as the day and allow some unrealistic years (actually depends what you are doing. Anyway show how to only allow year 19xx or 20xx)

Code:
(0[1-9]|[12][0-9]|3[01])-(JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC)-(19|20)\d\d

sweeeeeeet!!! thanx again mate!
im starting to understand this regexp thingy....(heared about it only before 2 days ago) :)
 
Back
Top