regex changing before last dot value

JavaScript
var str = 'esolri.gbn43sh.earbnf'
console.log(
  str.slice(str.lastIndexOf('.') + 1)
)
Source

Also in JavaScript: