run preg_replace() only once, on the whole string. see #271