Added escaping of n-gram when used in regular expression pattern.