var mth = []; mth["ноя"] = 11; alert("03 ноя 2014".replace(/(\d+)\s(\W+)\s(\d+)/, function(a, b, c, d) { return mth[c] ? b + "." + mth[c] + "." + d : a }));