src/Renderer/Twig/Extension.php
public function excerptHtml($string)
    {
        // https://regex101.com/r/mA2mG0/3
        $pattern = '^(.*)[\n\r\s]*<!-- excerpt -->[\n\r\s]*(.*)$';
        preg_match(
            '/'.$pattern.'/s',
            $string,
            $matches
        );
        if (!$matches) {
            return $string;
        }

        return trim($matches[1]);
    }
public function excerptHtml($string)
    {
        // https://regex101.com/r/mA2mG0/3
        $pattern = '^(.*)[\n\r\s]*<!-- excerpt -->[\n\r\s]*(.*)$';
        preg_match(
            '/'.$pattern.'/s',
            $string,
            $matches
        );
        if (!$matches) {
            return $string;
        }

        return trim($matches[1]);
    }
Read characters before '<!-- excerpt -->'.

@param $string

@return string