Improved replaceAll for Command