Edit in JSFiddle

$('p').html(function(i, html) {
    var re  = /(?:http:\/\/)?(?:www\.)?(?:youtube\.com|youtu\.be)\/(?:watch\?v=)?(.+)/g,
        vid = '<iframe width="420" height="345" src="http://www.youtube.com/embed/$1" frameborder="0" allowfullscreen></iframe>';
    return html.replace(re, vid);

});
body {
    padding:10px;
    background-color:#ccc;
}

iframe[src*="http://www.youtube.com/embed/"] {
    display:block;
    margin:0px auto 10px;
    border:2px solid black;
}
<p>
    http://youtu.be/-joKveiaabA
    http://www.youtube.com/watch?v=-joKveiaabA
</p>