preg_replace

Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Perform a regular expression search and replace
<?php preg_replace(    string|array $pattern,    string|array $replacement,    string|array $subject,    int $limit = -1,    int &$count = null): string|array|null
<?php     protected function formatPath(string $path): string

    {

        return preg_replace('/(?:\/)+$/u', '', $path).'/';

    }

}
<?php     protected function trimEmptyLines(string $value)

    {

        $value = preg_replace('/^\|---LINE:([0-9]+)---\|$/m', '', $value);



        return ltrim($value, PHP_EOL);

    }