Creating an attribute based on a regular expression