How to identify common substrings of two strings in Python?

Viewed 67

How can I find common substrings of two strings in order to show changes/edit of a string?

So what I try to do is to compare an old version of a string:

string_old = "My name is pm730! How are you?"

with a new/edited version of the string:

string_new = "My name isn't pm730, it is pm740!"

Deleted substrings are not important. New substrings should be distinguished somehow, so that I could output it like this eventually:

My name isn't pm730 , it is pm740!

This task sounds easy but is more complicated than I thought. So my hope is that there is already an similar implementation available, but unfortunanly I can't find it...

0 Answers
Related