<html>
<head>
<style>
</style>
</head>
<span id = "links">
<a href="http://youtube.com">youtube</a><br>
some text <br>
<a href="http://www.youtube.com/watch?foobar">youtube</a><br>
some text <br>
<a href="https://www.youtube.com">youtube</a><br>
some text <br>
<a href="http://noyoutube.com">noyoutube</a><br>
some text <br>
<a href="http://www.noyoutube.com">noyoutube</a><br>
some text <br>
</span>
<body>
<script>
links.innerHTML = links.innerHTML.replace(
/<\s*a\s+[\s\S]*?href\s*=\s*['"]\s*?https?:\/\/(www\.)?youtube\.com[^>]*>[^<]*<\s*\/\s*a[^>]*>/gi, ""
)
</script>
</body>
</html>