<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Пример</title>
</head>
<body>
<script>
var str = 'bla bla bla bla bla [youtube]https://www.youtube.com/watch?v=C0DPdy98e4c[/youtube]b la bb b[youtube]https://www.youtube.com/watch?v=C0DPdy98e4c[/youtube]lalbl a';
var pos = 0;
while (true) {
var pos1 = str.indexOf('[youtube]', pos);
var pos2 = str.indexOf('[/youtube]', pos);
if (pos2 == -1) break;
alert(str.substring(pos1+9, pos2));
pos = pos2 + 1;
}
</script>
</body>
</html>