On-line pattern matching on similar texts