Languages with mismatches and an application to approximate indexing