Replace variable number of character

hi All,

My requirement is to replace variable number of in between character with X

The first 6 and last 4 characters will remain same and rest characters will be masked with X

Example - input String 12345678912345 output 123456XXXX2345
input string 123456 output 12345 (as less than 10 digits)
input string 12345678912 output 123456X8912 (as total 11 digits)

Thanks for your help

What system are you on? Which tools will you use? What have you tried?

Andrew