8 – How can I replace file and static media links in the content with their equivalent entity references?

I have imported content from another system. So, for example, the body has a typical HTML code, like this:


Is there a way to retrospectively retrieve and replace all static link references with their Drupal 8 feature reference equivalents, perhaps by searching for the unique file name? Or is there a way to achieve this during the initial import / reimportation?

I also need to do it for internal links.