Use preg_replace.
<?php
$youtubeVideo = "[youtubeVideo:9bZkp7q19f0]";
$youtubeVideo = preg_replace('/\[(.*?):(.*?)\]/m', '<iframe width=\'560\' height=\'315\' src=\'//www.youtube.com/embed/$2\' frameborder=\'0\' allowfullscreen></iframe>', $youtubeVideo);
echo $youtubeVideo;
//<iframe width='560' height='315' src='//www.youtube.com/embed/9bZkp7q19f0' frameborder='0' allowfullscreen></iframe>
?>
REGEX EXPLANATION
\[(.*?):(.*?)\]
Match the character “[” literally «\[»
Match the regex below and capture its match into backreference number 1 «(.*?)»
Match any single character that is NOT a line break character (line feed) «.*?»
Between zero and unlimited times, as few times as possible, expanding as needed (lazy) «*?»
Match the character “:” literally «:»
Match the regex below and capture its match into backreference number 2 «(.*?)»
Match any single character that is NOT a line break character (line feed) «.*?»
Between zero and unlimited times, as few times as possible, expanding as needed (lazy) «*?»
Match the character “]” literally «\]»
<iframe width='560' height='315' src='//www.youtube.com/embed/$2' frameborder='0' allowfullscreen></iframe>
Insert the character string “<iframe width='560' height='315' src='//www.youtube.com/embed/” literally «<iframe width='560' height='315' src='//www.youtube.com/embed/»
Insert the text that was last matched by capturing group number 2 «$2»
Insert the character string “' frameborder='0' allowfullscreen></iframe>” literally «' frameborder='0' allowfullscreen></iframe>»