Regex doesn't solve all problems. For example, month names don't really follow a
pattern, so in order to get it to work you would need multiple different patterns to
test. This can be confusing at least, and hard to manage as well.
You might think about going at it a different way. For example, perhaps using a SimpleDateFormat will help you parse out the date
string you are looking for more efficiently (especially if you are doing more than just Month).
If you are just using months then maybe the SimpleDateFormat won't work (you run into the same problem with your original regex where "decimal" can be interpreted as "December") Providing a ResourceBundle with the intended month notations might prove easy to manage and maintain. Example, I created the following Properties file, which I can then use as a ResourceBundle
Then when I want to use it I can do this:
And run the test like:
(Yeah, I know, I misspelled both Properties and Resource in the class name :-( )
Using ResourceBundles has its benefits, it is easily localized (different abbreviations for different languages or regions), you can map the key to whatever value you want (I just used the full name, but you could use the Month index, or something else that makes sense), and with PropertyResourceBundle, it is easy to add/modify the values (even as the app is running).