use nil safe regex syntax, openstruct instead of hash