Faster mod matching without regexes.