Here's a sample data,
data_example1 = "1-19" #month, year (last two digits)
data_example2 = "12-21" #month, year (last two digits)
How can I write a regex to match this and then replace the year with zero padded.
This code seems to be working if month is single digit, how can I make it work for both one digit and two digit months. Also rather than split("-"), is there a way to use regex to zero pad the year alone.
if re.search("\d\-\d\d", data_example1):
month, year = data_example1.split("-")
cleaned_date = month + "-" + "00" + year # zero padded year