src/Matcher.php
public function match(string $subject, int $flags = 0, int $offset = 0) : array
    {
        preg_match($this->pattern->getPattern() . $this->modifier, $subject, $matches, $flags, $offset);

        if (($errno = preg_last_error()) !== PREG_NO_ERROR) {
            $message = array_flip(get_defined_constants(true)['pcre'])[$errno];
            switch ($errno) {
                case PREG_INTERNAL_ERROR:
                    throw new InternalException("{$message} using pattern: {$this->pattern->getPattern()}", $errno);
                case PREG_BACKTRACK_LIMIT_ERROR:
                    throw new BacktrackLimitException("{$message} using pattern: {$this->pattern->getPattern()}", $errno);
                case PREG_RECURSION_LIMIT_ERROR:
                    throw new RecursionLimitException("{$message} using pattern: {$this->pattern->getPattern()}", $errno);
                case PREG_BAD_UTF8_ERROR:
                    throw new BadUtf8Exception("{$message} using pattern: {$this->pattern->getPattern()}", $errno);
                case PREG_BAD_UTF8_OFFSET_ERROR:
                    throw new BadUtf8OffsetException("{$message} using pattern: {$this->pattern->getPattern()}", $errno);
                case PREG_JIT_STACKLIMIT_ERROR:
                    throw new JitStackLimitException("{$message} using pattern: {$this->pattern->getPattern()}", $errno);
            }
        }

        return $matches;
    }
public function match(string $subject, int $flags = 0, int $offset = 0) : array
    {
        preg_match($this->pattern->getPattern() . $this->modifier, $subject, $matches, $flags, $offset);

        if (($errno = preg_last_error()) !== PREG_NO_ERROR) {
            $message = array_flip(get_defined_constants(true)['pcre'])[$errno];
            switch ($errno) {
                case PREG_INTERNAL_ERROR:
                    throw new InternalException("{$message} using pattern: {$this->pattern->getPattern()}", $errno);
                case PREG_BACKTRACK_LIMIT_ERROR:
                    throw new BacktrackLimitException("{$message} using pattern: {$this->pattern->getPattern()}", $errno);
                case PREG_RECURSION_LIMIT_ERROR:
                    throw new RecursionLimitException("{$message} using pattern: {$this->pattern->getPattern()}", $errno);
                case PREG_BAD_UTF8_ERROR:
                    throw new BadUtf8Exception("{$message} using pattern: {$this->pattern->getPattern()}", $errno);
                case PREG_BAD_UTF8_OFFSET_ERROR:
                    throw new BadUtf8OffsetException("{$message} using pattern: {$this->pattern->getPattern()}", $errno);
                case PREG_JIT_STACKLIMIT_ERROR:
                    throw new JitStackLimitException("{$message} using pattern: {$this->pattern->getPattern()}", $errno);
            }
        }

        return $matches;
    }
public function match ( string $ subject , int $ flags = 0 , int $ offset = 0 ) : array { preg_match ( $ this -> pattern -> getPattern ( ) . $ this -> modifier , $ subject , $ matches , $ flags , $ offset ) ; if ( ( $ errno = preg_last_error ( ) ) !== PREG_NO_ERROR ) { $ message = array_flip ( get_defined_constants ( true ) [ 'pcre' ] ) [ $ errno ] ; switch ( $ errno ) { case PREG_INTERNAL_ERROR : throw new InternalException ( "{$message} using pattern: {$this->pattern->getPattern()}" , $ errno ) ; case PREG_BACKTRACK_LIMIT_ERROR : throw new BacktrackLimitException ( "{$message} using pattern: {$this->pattern->getPattern()}" , $ errno ) ; case PREG_RECURSION_LIMIT_ERROR : throw new RecursionLimitException ( "{$message} using pattern: {$this->pattern->getPattern()}" , $ errno ) ; case PREG_BAD_UTF8_ERROR : throw new BadUtf8Exception ( "{$message} using pattern: {$this->pattern->getPattern()}" , $ errno ) ; case PREG_BAD_UTF8_OFFSET_ERROR : throw new BadUtf8OffsetException ( "{$message} using pattern: {$this->pattern->getPattern()}" , $ errno ) ; case PREG_JIT_STACKLIMIT_ERROR : throw new JitStackLimitException ( "{$message} using pattern: {$this->pattern->getPattern()}" , $ errno ) ; } } return $ matches ; }
Retrieve match from subject with Pattern
@param string $subject
@param int $flags
@param int $offset
@return array
@throws BacktrackLimitException
@throws BadUtf8Exception
@throws BadUtf8OffsetException
@throws InternalException
@throws JitStackLimitException
@throws RecursionLimitException
Retrieve match from subject with Pattern