javascript,jquery,contains,textmatching

Answer to the question can be found in the fiddle -> https://jsfiddle.net/mLbhLh89/11/ .

Because you're searching for the bounded overlap, this is a simple enough problem that brute force is the way to go. Equalize the string lengths, and then just chop off characters until you find a match. There are some potential avenues to make this more efficient, but only explore those...

Did you look at measuring document similarity by cosine distance? Cosine similarity is a measure of similarity between two vectors of an inner product space that measures the cosine of the angle between them http://en.wikipedia.org/wiki/Cosine_similarity If you have Document A and B, You can create two term vectors for the...