public function match($input)
    {
        // Match the input with the regex pattern, storing any match found into the $matches variable,
        // along with the index of the string at which it was matched.
        $result = preg_match($this->pattern, $input, $matches, PREG_OFFSET_CAPTURE);

        // preg_match returns false if an error occured
        if ($result === false)
            throw new \Exception(preg_last_error());

        // 0 means no match was found
        if ($result === 0)
            return null;

        return $this->getTokenFromMatch($matches[0]);
    }
public function match($input)
    {
        // Match the input with the regex pattern, storing any match found into the $matches variable,
        // along with the index of the string at which it was matched.
        $result = preg_match($this->pattern, $input, $matches, PREG_OFFSET_CAPTURE);

        // preg_match returns false if an error occured
        if ($result === false)
            throw new \Exception(preg_last_error());

        // 0 means no match was found
        if ($result === 0)
            return null;

        return $this->getTokenFromMatch($matches[0]);
    }
public function match ( $ input ) { // Match the input with the regex pattern, storing any match found into the $matches variable, // along with the index of the string at which it was matched. $ result = preg_match ( $ this -> pattern , $ input , $ matches , PREG_OFFSET_CAPTURE ) ; // preg_match returns false if an error occured if ( $ result === false ) throw new \ Exception ( preg_last_error ( ) ) ; // 0 means no match was found if ( $ result === 0 ) return null ; return $ this -> getTokenFromMatch ( $ matches [ 0 ] ) ; }
Try to match the given input to the current TokenDefinition.

@param string $input Input string
@retval Token|null Token matching the regular expression defining the TokenDefinition
Try to match the given input to the current TokenDefinition .