-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
  • 4,037
  • 20
  • 69
  • 129

1 Answers1

0

You can use

/(0[1-9])|(1[0-2])/
marvel308
  • 10,288
  • 1
  • 21
  • 32