Start a new topic

Looking for a regular expression to add a zero to the beginning of a date

using this one currently:

^[0-3][0-9]/[0-3][0-9]/(?:[0-9][0-9])?[0-9][0-9]$

The problem is, if there is already a 0 at the beginning of the date, this regex adds an additional 0, leaving us with:

003/25/15

Is there a way to add a 0 at the beginning of the date, but only if there is not already a 0 present?

 


1 person has this question
Login or Signup to post a comment