Regex to match date formats DD-MM-YYYY and DD/MM/YYYY

regular expression for date format mm/dd/yyyy or m/d/yyyy
regular expression for date format dd-mmm-yyyy
regular expression for date format dd/mm/yyyy in javascript
regex for all date formats
regex date yyyy-mm-dd hh-mm-ss
regular expression to check date format mm/dd/yyyy in oracle
regular expression for date format dd/mm/yyyy in python
regular expression for date format dd/mm/yyyy in c#

I'm working in Sublime Text 3 with a large text file that has entries separated by lines. I'm looking for a regular expression that will:

  • Match entries that appear in the DD-MM-YYYY format
  • Match entries that appear in the DD/MM/YYYY format

If both would be too complicated, then just the first example will do.

I haven't done anything to work towards such a regex, because it's honestly way above my knowledge of it and I wouldn't know where to start, and looking at similar answers dealing with regex validation of date formats confirms those suspicions for me.

Thanks in advance for any help.


This pattern will work for your conditon. Strictly not allowed month to date and vice versa.

^([0]?[1-9]|[1|2][0-9]|[3][0|1])[./-]([0]?[1-9]|[1][0-2])[./-]([0-9]{4}|[0-9]{2})$

This pattern will match these formats: (Date, Month, Year)

25.04.2017  
02.04.2017  
2.4.2017  

25/04/2017  
5/12/2017  
15/2/2017  

25-04-2017  
6-10-2017  
16-5-2017  

Regex to validate date format dd/mm/yyyy, Regular Expression to. Simple date dd/mm/yyyy. Comments. Post Posting GuidelinesFormatting match a wide range of international phone number  Match dates (M/D/YY, M/D/YYY, MM/DD/YY, MM/DD/YYYY) This regex will match a string as a date in the formats M/D/YY, M/D/YYY, MM/DD/YY, and MM/DD/YYYY. It does not correct for leap year.


This regex matches your example:

[0-9]{2}[-|\/]{1}[0-9]{2}[-|\/]{1}[0-9]{4}

but if you write wrong date (like 31 Feb) this regex match it.

Expressions in category: Dates and Times, Date DD/MM/YYYY. Fork (ctrl-s); New Roll over matches or the expression for details. PCRE & JavaScript flavors of RegEx are supported. Validate your  This expression can be used to find or validate a date field and the most accepted form of date can have DD-MM-YYYY format with the seperators: -, / and.


Check This:

([0-2][0-9]|(3)[0-1])[-|\/](((0)[0-9])|((1)[0-2]))[-|\/]\d{4}

I think this is perfect match for your answer. It takes date upto 31, month upto 12.

Date format by country, Dates: in dd/mm/yyyy or d/m/yy format between 1/1/1600 - 31/12/9999. Leading zeroes are optional. Date separators can be either matching dashes(-),  You have dd/MM/yyyy and want yyyy/MM/dd?! Err, how about simply reordering your current pattern? Err, how about simply reordering your current pattern? And I agree with the other comments: better use Java's built-in date-formatter (and parser) functionality.


Valid Date, Selection from Regular Expressions Cookbook, 2nd Edition [Book] You want to validate dates in the traditional formats mm/dd/yy, mm/dd/yyyy, dd/mm/yy, Solution 1: Match any of these date formats, allowing leading zeros to be omitted: Regex used in .NET to validate a date. Matches the following formats mm/dd/yy, mm/dd/yyyy, mm-dd-yy, mm-dd-yyyy This covers days with 30 or 31 days but does not handle February, it is allowed 30 days.


Simple date dd/mm/yyyy, In this Java date validation example using regex, we will learn to validate simple date formats such as mm/dd/yy, mm/dd/yyyy with or without leading zeros. Java date validation regex – match “mm/dd/yyyy” with required leading zeros. Regex  Unfortunately, all it does is match valid numbers in a date time input, and 31st Feb will be marked as valid, but as so many have said, regex really isn't the best tool to do this test. To match a date in the format 'yyyy-MM-dd hh:mm' (Or indeed in whatever order you please)


Date DD/MM/YYYY, Following is the regular expression to match date in dd-MM-yyyy format: ^(1[0-2]|​0[1-9])/(3[01]|[12][0-9]|0[1-9])/[0-9]{4}$. Therefore, to validate a  You can watch a short video on this article here: python regular expression matching dates. You can be interested in Python project: Python useful tips and reference project. Regex Matching Date 10/10/2015. Regex date format: dd/mm/yyyy [\d]{1,2} - match one or two digits [\d]{4} - match exactly 4 digits; separator is /