text = c('Current year is 2025', 'Current year is 2025')
mon = c('06', '12')
Please give an example of the full input structure.
We can develope something robust from
s = format(as.Date(sprintf('%s-%s-01', sub('\\D+', '', text), mon))+31, '%Y %b')
Does text
always contain a four-digit representation of a year? No more numbers?
> s [1] "2025 Jul" "2026 Jan"