I have a string from which I want to extract month name and year with Python regex. The string looks like the following-
x='januray valo na Feb 2017 valo Jan-2015 anj 1900 puch Janu Feb Jan Mar 15 MMMay-85 anF 15'
I code should return the following-
['Feb 2017', 'Jan-2015', 'Mar 15', 'May-85']
I have tried-
re.findall('[Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec]{3}[\s-]\d{2,4}', x)
But I the code picking up anF 15 as well, i.e. I am getting the following output-
['Feb 2017', 'Jan-2015', 'Mar 15', 'May-85', 'anF 15']
How can I stop the code from picking up wroong combinations like Jan|Feb?