I didn't know you could use regexes in case statements! I'll rewrite, that'll be quite a bit cleaner.