Fixing dates - 1



examples/regex/fix_date1.py
from date import test_date
import re

def fix_date1(date):
    return re.sub(r'-(\d)', r'-0\1', date)

test_date(fix_date1)

      old: 2010-07-05
      new: 2010-007-005
 expected: 2010-07-05

      old: 2010-07-5
      new: 2010-007-05
 expected: 2010-07-05

      old: 2010-11-5
      new: 2010-011-05
 expected: 2010-11-05

      old: 2010-7-15
      new: 2010-07-015
 expected: 2010-07-15