Keeping code simple with regular expressions