$str =~ s/(?:.+?\n){5}//m;
this works wery well in perl, when i need to rmove couple of lines from file (or anything else separated with newlines ... or /(?:.+?)$/m... doesn't matter).
But why this doesn't work in php:
$str = preg_replace("/(?:.+?\n){5}/m", '', $str);
More prciesly it works, bu very greedy🙁