INT-3403: Fix the `replaceAll` logic