I have a string variable, something like "thisMagazineRoomcode". I need slice this from "R" - last capital letter till the end of the string. Slice method doesn't suit me because I have different variable like "thisMagazineName" or "thisMagazineSquare" with different letter quantity after captial letter.
You can use
console.log( 'thisMagazineRoomcode'.replace(/[A-Z][^A-Z]*$/, '') );