function cropSrc ($html) {
$end = (strpos($html, 'www.youtube.com') !== false) ? strlen($html) - 1 : strpos($html, ' ');
return substr($html, 0, $end);
}
$s1 = 'src="//www.youtube.com/embed/Tkk-ensUpqU?wmode=transparent">';
$s2 = 'src="/video/video_test.mp4" type="application/x-shockwave-flash" pluginspage="www.macromedia.com/go/getflashplayer" >';
echo cropSrc($s1) . '<br>';
echo cropSrc($s2);
$('.class').attr('src')
var srcString = $(".class").attr("src");
var resultString = 'src="'+srcString+'"';