I want to compare 2 text values on a web page and highlight the differences. Can I do this client-side, preferably with jQuery or Prototype?
This diff-patch-match library appears to do a really good job:
http://code.google.com/p/google-diff-match-patch/
The project has JavaScript, C#, C++, Python, and Java implementations that all do the same thing.
Check out the the wikEd diff library and the online tool and demo.
The library creates inline text comparisons with block move highlighting and is character/word-based. It has been optimized for Wikipedia, but works equally well for other text types and program code. The library code is customizable, has Unicode support, is extensively commented, and is free (PD).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With