Determine if two strings are similar in Javascript?

Tegan Snyder picture Tegan Snyder · Oct 14, 2010 · Viewed 12.4k times · Source

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

Answer

rtalbot picture rtalbot · Oct 14, 2010

The wikipedia entry for Levenshtein distance includes a sample implementation.