public function match($pattern, $modifiers = null, $ignoredSuffixes = null)
    {
        $modifiers = $modifiers ?: '';
        $ignoredSuffixes = $ignoredSuffixes ?: "\n";
        $matches = null;
        $this->lastMatchResult = null;
        $this->nextConsumeLength = null;

        $result = preg_match(
            "/^$pattern/$modifiers",
            $this->input,
            $matches
        );

        if ($result === false) {
            $this->throwException(
                'Failed to match pattern: '.$this->getPregErrorText()
            );
        }

        if ($result === 0) {
            return false;
        }

        $this->lastMatchResult = $matches;
        $this->nextConsumeLength = mb_strlen(rtrim($this->lastMatchResult[0], $ignoredSuffixes));

        return true;
    }
public function match($pattern, $modifiers = null, $ignoredSuffixes = null)
    {
        $modifiers = $modifiers ?: '';
        $ignoredSuffixes = $ignoredSuffixes ?: "\n";
        $matches = null;
        $this->lastMatchResult = null;
        $this->nextConsumeLength = null;

        $result = preg_match(
            "/^$pattern/$modifiers",
            $this->input,
            $matches
        );

        if ($result === false) {
            $this->throwException(
                'Failed to match pattern: '.$this->getPregErrorText()
            );
        }

        if ($result === 0) {
            return false;
        }

        $this->lastMatchResult = $matches;
        $this->nextConsumeLength = mb_strlen(rtrim($this->lastMatchResult[0], $ignoredSuffixes));

        return true;
    }
public function match ( $ pattern , $ modifiers = null , $ ignoredSuffixes = null ) { $ modifiers = $ modifiers ? : '' ; $ ignoredSuffixes = $ ignoredSuffixes ? : "\n" ; $ matches = null ; $ this -> lastMatchResult = null ; $ this -> nextConsumeLength = null ; $ result = preg_match ( "/^$pattern/$modifiers" , $ this -> input , $ matches ) ; if ( $ result === false ) { $ this -> throwException ( 'Failed to match pattern: ' . $ this -> getPregErrorText ( ) ) ; } if ( $ result === 0 ) { return false ; } $ this -> lastMatchResult = $ matches ; $ this -> nextConsumeLength = mb_strlen ( rtrim ( $ this -> lastMatchResult [ 0 ] , $ ignoredSuffixes ) ) ; return true ; }
Matches current input string against a regular expression.

The result length will be stored and can be consumed with `consume()` later on.

Notice that ^ is automatically prepended to the pattern.

@param string $pattern         the regular expression without slashes or modifiers.
@param string $modifiers       the modifiers for the regular expression.
@param string $ignoredSuffixes characters that are scanned, but don't end up in the consume length.

@throws ReaderException

@return bool wether the expression matched or not.
Matches current input string against a regular expression .