Use Regex instead of two string comparisons.