I am trying to construct a RegExp to append text before the last occurrence of the string, but in the current approach, the replaced .html part is lost. Can you please suggest how can it be fixed?
const URL = 'www.website.com/path/fileName.html'
const urlPrefix = '.prefix1.prefix2'
const newURL = URL.replace(/.html(^)*$/, `${urlPrefix}$1`)
// Expected output www.website.com/path/fileName.prefix1.prefix2.html
console.log(newURL)