use a regex instead of manual comparisons