Approximate pattern matching working