I've had good luck using the Search Regex plugin (https://wordpress.org/plugins/search-regex/) for site migrations and repetitive changes. It also lets you preview before making a change.