in reply to Re^2: Quick Regex Question
in thread Quick Regex Question

Well.. that is easy... your dates are DD/MM/YYYY bust your regexp is MM/DD/YYYY first section matches 00 to 19, second matches 00 to 39, so many values you pass would fail...
/^(?:[0-3]\d\/[01]\d\/(?:19|20)\d\d)?$/
will do it, but as other people have said, there are better ways.

                - Ant
                - Some of my best work - (1 2 3)

Replies are listed 'Best First'.
Re^4: Quick Regex Question
by Trihedralguy (Pilgrim) on May 07, 2007 at 20:47 UTC
    I need to do dd/mm/yyyy - I accidentally ignored my mistake within my error message. How would I switch your regex around to use dd/mm/yyyy instead of mm/dd/yyyy
      Just switch before and after the first /
      /^(?:[01]\d\/[0-3]\d\/(?:19|20)\d\d)?$/
      But the test data you said you used was 03/30/2007 which is MM/DD/YYYY

                      - Ant
                      - Some of my best work - (1 2 3)