Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8431351
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T05:49:54+00:00 2026-06-10T05:49:54+00:00

what will be the regular expression of date format like ’01-Aug-12′. I have the

  • 0

what will be the regular expression of date format like '01-Aug-12'.

I have the date format of dd-M-y in asp.net application and want to validate it from asp.net regular expression validator control.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T05:49:56+00:00Added an answer on June 10, 2026 at 5:49 am

    This won’t be too elegant, but if you want to use regex to validate dates, it is here:

    The regex with explanation

    (
      (
        31-(Jan|Mar|May|Jul|Aug|Oct|Dec)|                                   # months with 31 days
        (0[1-9]|[12]\d|30)-(Jan|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)|   # months with 30 or 31 days
        (0[1-9]|1\d|2[0-8])-Feb                                             # February up to 28th
      )
      -\d\d                                                                 # any two digits represent the year
    )|
    (
        29-Feb-([02468][048]|[13579][26])                                   # February 29th
    )
    

    This regex doesn’t accept invalid dates like 00-Aug-00, 32-Aug-00 and 29-Feb-01 while accepting valid dates including leap days (29-Feb-04). Note that we assume 00 stands for year 2000, not 1900. So, we accepted 29-Feb-00 as leap day!

    In one line:

    See it in action:

    ((31-(Jan|Mar|May|Jul|Aug|Oct|Dec)|(0[1-9]|[12]\d|30)-(Jan|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)|(0[1-9]|1\d|2[0-8])-Feb)-\d\d)|(29-Feb-([02468][048]|[13579][26]))
    

    Case-insensitivity

    In Javascript, add an i as second parameter:

    var re = new RegExp(regexStr, "i");
    

    In ASP.NET, use RegexOptions.IgnoreCase:

    Regex re = new Regex(regexStr,RegexOptions.IgnoreCase);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am looking for a regular expression for c# asp.net 3.5 that will fail
I have a Java EE application and I want to validate a Date. With
I want a Perl regular expression that will match duplicated words in a string.
I need to find a regular expression which will support the following format .[A-Z-a-z]/-
I'm working on a regular expression that will only return true when a date
I am looking for a regular expression that will accept date formats, both MM/DD/YYYY
I want to validate textbox so that it will accept only future date. Can
I have this regular expression to validate the URL: ^[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(/\S*)?$^ . This regular expression
I read this and got really interested: Validating date format using regular expression so
What will be the regular expression to accept 'CP123' First two letters CP and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.