Replace Month Name with Number

IMO the best tool for this job is JavaScript, not RegEx.
I was pleasantly surprised to find that the month name need only be matched using the first 3 characters. So, I'm not sure what language you are using, but this seems to work for the two examples. I would expect JavaScript to use the local language as installed on your Mac.

See if this works for you.

Example Output

image

MACRO:   Get Month Number from Month Name [Example]

~~~ VER: 1.0    2019-10-18 ~~~
Requires: KM 8.2.4+   macOS 10.11 (El Capitan)+
(Macro was written & tested using KM 9.0+ on macOS 10.14.5 (Mojave))

DOWNLOAD Macro File:

Get Month Number from Month Name [Example].kmmacros
Note: This Macro was uploaded in a DISABLED state. You must enable before it can be triggered.


JXA Script

(function (){
'use strict';

var kme = Application("Keyboard Maestro Engine");
var monthName = kme.getvariable("Month_Name") || "KM Var is missing/empty";

var monthIndex = new Date('1 ' + monthName + ' 2000').getMonth() + 1;

if (monthIndex) {
  return monthIndex.toString().padStart(2, '0');
}
else {
  throw new Error('[ERROR]  Invalid Month Name: ' + monthName); 
}

})();