fully compressed pattern matching