I want to remove the domain input_number. and _slider from the entity input_number.shutter_room_slider to get shutter_room, but I get an output without first letter hutter_room for shutter or nput_number.shutter_room.
you want to use replace not strip. strip strips leading and trailing characters in order that you provided. Which is why your stripping s or i or random characters from the front or back of your string.
yah just realize that if you use replace and your entity_id looks like this input_number.shutter_room_slider_slider your output will be input_number.shutter_room_level_level