using a chained replace instead of a callback replace