KMP-based wildcard patterns match algorithm