Fixed whitespace breaking pattern replace bug