https://www.mathworks.com/help/matlab/matlab_prog/searching-and-replacing.html
regexprep can also be used.
I can also offer you code for r2019a and later that converts all floating point software numbers into rationals. In the case of integers with .0 that would construct the integers. However there is the issue that vpa shows you a truncated value that is not necessarily exactly what is stored, so if the numbers do not convert exactly to integers then they might not come out as expected. But the code could easily be adapted to round before converting to rational.