Regular expression for validating date


You can’t tell a regular expression to “match a number between 1 and 31”.

regular expression for validating date-73regular expression for validating date-81

(0[1-9]|1[0-9]|2[0-8]))|([0-9](([2468][048]|[02468][48])|[13579][26])|([13579][26]|[02468][048]|0[0-9]|1[0-6])00)[-/]? “31/9/2010”, “31/09/2010” – September has 30 days only 10. “31/6/2010”, “31/06/2010” -June has 30 days only 9.In this regex tutorial, we will learn to validate simple date formats e.g. Here, we want to use a regex that simply checks whether the input looks like a date, without trying to eliminate things such as February 31st.You might think that something as conceptually trivial as a date should be an easy job for a regular expression. The main issue is that regular expressions don’t deal directly with numbers.^(((0[1-9]|[12]\d|3[01])\/(0[13578]|1[02])\/((19|[2-9]\d)\d))|((0[1-9]|[12]\d|30)\/(0[13456789]|1[012])\/((19|[2-9]\d)\d))|((0[1-9]|1\d|2[0-8])\/02\/((19|[2-9]\d)\d))|(29\/02\/((1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00))))$ Matches [29/02/2000], [30/04/2003], [01/01/2003] Non-Matches [29/02/2001], [], [1/1/1899] or check this link Script/0520__Regular-Expressions/Use Regular Good Luck google will give you 20400 results for your query

You must have an account to comment. Please register or login here!