You can use the microflow expression replaceAll.
replaceAll('this is a string with 75 some numbers 234 thrown in', '([0-9])', 'NUMBER')
->
'this is a string with NUMBERNUMBER some numbers NUMBERNUMBERNUMBER thrown in'
Use the HTMLEncode function from community commons module https://appstore.mendix.com/link/app/Community%20Commons%20Function%20Library (or add an RFC if it does not exactly what you want ;-))