-1

I'm using the regex from this question Regular Expression Help for Date Validation - dd/mm/yyyy - PHP from validating the date format

/^[0-9]{1,2}\/[0-9]{1,2}\/[0-9]{4}$/

However I'd also like to ensure that the date is in this specific format DD/MM/YYYY and NOT as MM/DD/YYYY, so I was wondering whether there's a way to "tell" my regex that this part

\/[0-9]{1,2}\/

should also have a value up to 12

ltdev
  • 3,461
  • 17
  • 60
  • 117

1 Answers1

0

You can use

/(0[1-9])|(1[0-2])/
marvel308
  • 9,972
  • 1
  • 18
  • 31