I had to find a answer for this question when I moved this site for another server. Actually, my domain didn’t change but I had lot of internal links on almost one hundred posts that started with “https” when I’m not using “https” anymore. So basically, I would have to replace “https://marceljm.com” by “http://marceljm.com” on all posts. How to do that without going crazy? Using MySQL! You just need 1 UPDATE using REPLACE function.

UPDATE marceljm_posts
 SET post_content = REPLACE(post_content,'https://marceljm','http://marceljm')
 WHERE post_content LIKE '%https://marceljm%';

So here we are updating  the table that contains posts data (something_posts) setting a new value to the column post_content. The new value is just the old value modified by REPLACE function that gets the undesirable subtext and converts it in the subtext we want. After run that, we COMMIT the changes. P.S.: WHERE clause was not necessary here but I have a terrible fear to run UPDATES or DELETES without it.

I'm sure you can easily adapt this command to your issue but of course you still can leave me a comment if you have any doubt.