<iframe id="embed-1502305489435" name="embed-1502305489435" src="https://oembedly.com/embed.php?url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DJvG1E0_Nazg"></iframe>
Sometimes the embed code needs to be updated, but I will see legacy embed codes such as the above.
I would like to replace the above with a normal hyperlink to the YouTube URL contained within the src attribute, matching any iframes with an id like "Embed-*".
I would like to do this with JQuery:
$('[id^=embed-]').each(function() {
var source = $(this).attr('src');
// if: is it youtube (regex here)?
// - replace iframe with hyperlink
});
I've used REGEX quite a lot, in that I copy and paste examples of the Internet. A solution would be fantastic, but also a pointer in how I can fathom this witchcraft in the future would be fantastic.