first = 'Joe went to the store and bought 2 loaves of bread' second = 'Joe and I went to the market and bought 3 loaves of bread and butter' assert_equal [4..9, 21..29, 57..68], diff(first, second) # diff() returns a list of Ranges spanning the position of edits or insertions Anyone know an algorithm (or code) that can make that work?