Does not work with comma
giorgio79 opened this issue · comments
György Chityil commented
Tried
var diffs = worddiff.diffString(
"Tom , reads novels but Jack reads comics .",
"Tom reads novels , but Jack reads comics ."
);
console.log(diffs);
and I am getting
[ { text: 'Tom , reads novels but Jack reads comics .' } ]
Therefore no difference is detected...
György Chityil commented
And a runkit sample https://runkit.com/embed/lreu16ado691
Bruno Bernard commented
That is something to do with
Line 37 in 41a7f0b
it returns only words.
Instead it can use o.split(/\s+|\\W/)
>> "Tom reads novels , but Jack reads comics .".split(/\s+|\\W/)
>> (9) ['Tom', 'reads', 'novels', ',', 'but', 'Jack', 'reads', 'comics', '.']