preg_match_all

Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Perform a global regular expression match
<?php preg_match_all(    string $pattern,    string $subject,    array &$matches = null,    int $flags = 0,    int $offset = 0): int|false
<?php     {

        $pattern = sprintf('/(@)?%s\s*(.+?)\s*%s(\r?\n)?/s', $this->contentTags[0], $this->contentTags[1]);



        if (preg_match_all($pattern, $value, $matches, PREG_OFFSET_CAPTURE)) {

            foreach (array_reverse($matches[0]) as $match) {

                $position = mb_strlen(substr($value, 0, $match[1]));
<?php     protected function addStatementLineNumbers(string $value)

    {

        $shouldInsertLineNumbers = preg_match_all(

            '/\B@(@?\w+(?:::\w+)?)([ \t]*)(\( ( (?>[^()]+) | (?3) )* \))?/x',

            $value,

            $matches,

            PREG_OFFSET_CAPTURE

        );



        if ($shouldInsertLineNumbers) {

            foreach (array_reverse($matches[0]) as $match) {