`$this->key = preg_replace('/[^\w_]+/', '_', $this->getAttribute("key"));` would be easier