Compile pattern before checking

Wait a couple minutes, I'll add a test for this case.