Whoops, put it back to using str_replace, not preg_replace, as didn't need the latter.