- preg_match: documentation ( source)
<?php
$text = '<script type="text/javascript">
var player = new Playerjs({
id: "videoplayer2535",
file:"https://ashdi.vip/content/stream/films/zavtra_ne_pomre_nkoli_2535/hls/index.m3u8",
poster:"https://ashdi.vip/content/stream/films/zavtra_ne_pomre_nkoli_2535/screen.jpg",
subtitle:"",
});
</script>';
preg_match('/file:"\K[^"]+/', $text, $matches);
echo $matches[0];