public function regexMatch($pattern, $options = '')
    {
        // Ensure the options contain the "u" modifier.
        if (!$this->newSelf($options)->contains('u')) $options .= 'u';

        // Build the expression
        $expression =
            $this->regexDelimiter.
            $pattern.
            $this->regexDelimiter.
            $options
        ;

        // Run the expression
        $result = preg_match($expression, $this->scalarString);

        // If no errors return true or false based on number of matches found.
        if ($result !== false) return $result === 1;

        // Otherwise throw with last known PCRE Error.
        throw new PcreException();
    }
public function regexMatch($pattern, $options = '')
    {
        // Ensure the options contain the "u" modifier.
        if (!$this->newSelf($options)->contains('u')) $options .= 'u';

        // Build the expression
        $expression =
            $this->regexDelimiter.
            $pattern.
            $this->regexDelimiter.
            $options
        ;

        // Run the expression
        $result = preg_match($expression, $this->scalarString);

        // If no errors return true or false based on number of matches found.
        if ($result !== false) return $result === 1;

        // Otherwise throw with last known PCRE Error.
        throw new PcreException();
    }
public function regexMatch ( $ pattern , $ options = '' ) { // Ensure the options contain the "u" modifier. if ( ! $ this -> newSelf ( $ options ) -> contains ( 'u' ) ) $ options .= 'u' ; // Build the expression $ expression = $ this -> regexDelimiter . $ pattern . $ this -> regexDelimiter . $ options ; // Run the expression $ result = preg_match ( $ expression , $ this -> scalarString ) ; // If no errors return true or false based on number of matches found. if ( $ result !== false ) return $ result === 1 ; // Otherwise throw with last known PCRE Error. throw new PcreException ( ) ; }
Returns true if the string matches the supplied pattern, false otherwise.

@param  string $pattern Regex pattern to match against.

@param  string $options Matching conditions to be used.

@return bool

@throws PcreException   When PCRE Error occurs.
Returns true if the string matches the supplied pattern false otherwise .