How to Replace the first x characters of a string with a specific character

Thank you so much @ppr for your help, how about if the first few characters are dynamic? like what if the first row has 16 digits while the second row has only 12 and I want the last four to be shown while the first few characters will be replaced by ‘X’?