var inputString = 'a.b.c.d.e.f';
var pattern = inputString.match(/([^\.]+)\.[^\.]+$/)[1];
console.log(pattern);
I have successfully implemented the code using regular expressions, but I am open to exploring more efficient solutions for extracting the last two strings separated by a DOT (.) character.