Returned re.compile to inside function because @StoneyJackson says
moving it outside was a bad idea. His proposed solution is more
complicated than I want to deal with right now...