Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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????

Posted

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)

 

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

Posted
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)

 

(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) :)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...