Editor: Fix bug where replaceAll could enter an infinite loop