How to fix old embeded iframes with WP-CLI search-replace

You should probably use something like regex101.com to test this before you run it on a database.

You could start off with something like:

wp search-replace '<iframe ((width|height|frameborder)="\d+" |allowfullscreen)+?src="https://wordpress.stackexchange.com/questions/222382/https?:\/\/www\.youtube\.com\/embed\/([a-zA-Z0-9]+?)" ((width|height|frameborder)="\d+" |allowfullscreen)+?>\<\/iframe\>' 'https://www.youtu.be/$1' --regex

but I’m not 100% sure of that…