Consider two random sequences $X_1 \cdots X_n$ and $Y_1 \cdots Y_n$ of i.i.d. letters in which the probability that two distinct letters match is $p > 0$. For each value $a$ between $p$ and 1, the length of the longest contiguous matching between the two sequences, requiring only a proportion $a$ of corresponding letters to match, satisfies a strong law analogous to the Erdos-Renyi law for coin tossing. The same law applies to matching between two nonoverlapping regions within a single sequence $X_1 \cdots X_n$, and a strong law with a smaller constant applies to matching between two overlapping regions within that single sequence. The method here also works to obtain the strong law for matching between multidimensional arrays, between two Markov chains and for the situation in which a given proportion of mismatches is required.
"The Erdos-Renyi Strong Law for Pattern Matching with a Given Proportion of Mismatches." Ann. Probab. 17 (3) 1152 - 1169, July, 1989. https://doi.org/10.1214/aop/1176991262