views:

53

answers:

2

Let's say I have two strings, is there any way to check if they are at least 90% similar?

var string1 = "theBoardmeetstoday,tomorrow51";
var string2 = "Board meets today, tomorrow";

Thanks,

Tegan

+2  A: 

jsdifflib is a JavaScript port of Python's excellent difflib library.

It has a function ratio() which "return[s] a measure of the sequences’ similarity as a float in the range [0, 1]."

RichieHindle
taking a look at that now... thanks
Tegan Snyder
+2  A: 

The wikipedia entry for Levenshtein distance includes a sample implementation.

rtalbot
thanks! this works awesome
Tegan Snyder