Skip to main content
Post Closed as "Needs more focus" by mkrieger1, Prophet, user15801675
deleted 4 characters in body; edited tags; edited title
Source Link
mkrieger1
  • 21.8k
  • 5
  • 61
  • 74

How to highlightidentify common substrings of two strings in Python?

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

So what I try to do is to compare aan 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 higlighteddistinguished 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...

How to highlight common substrings of two strings in Python?

How can I easly highlight common substrings of two strings in order to show changes/edit of a string. So what I try to do is to compare a 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 higlighted 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...

How to identify common substrings of two strings in Python?

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...

Source Link
Pm740
  • 371
  • 2
  • 13

How to highlight common substrings of two strings in Python?

How can I easly highlight common substrings of two strings in order to show changes/edit of a string. So what I try to do is to compare a 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 higlighted 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...