No need for jquery. Simple javascript will do. I can only give you a function to find the longest common start line.
function commonStart(array){ var x = array.slice(0).sort(), word1 = x[0], word2 = x[x.length-1], i= 0; while(word1.charAt(i) == word2.charAt(i)) ++i; return word1.substring(0, i); }
eg.
var testArray = ['testone','testtwo','testthree']; commonStart(testArray);
will give 'test'
The standard tool for this kind of thing in Bioinformatics is the BLAST program. It is used to compare two fragments of molecules (for example, DNA or proteins) to find where they align with each other - basically, where two lines (sometimes several GB in size) have common substrings.
source share