public function matches($regexp, $message)
    {
        if (!is_string($regexp) || !is_string($message)) {
            throw new \InvalidArgumentException("Both arguments must be string.");
        }
        $this->constraints[] = (function (Password $str) use ($regexp, $message) {
            if (!preg_match($regexp, $str)) {
                return $message;
            } else {
                return true;
            }
        });
        return $this;
    }
public function matches($regexp, $message)
    {
        if (!is_string($regexp) || !is_string($message)) {
            throw new \InvalidArgumentException("Both arguments must be string.");
        }
        $this->constraints[] = (function (Password $str) use ($regexp, $message) {
            if (!preg_match($regexp, $str)) {
                return $message;
            } else {
                return true;
            }
        });
        return $this;
    }
public function matches ( $ regexp , $ message ) { if ( ! is_string ( $ regexp ) || ! is_string ( $ message ) ) { throw new \ InvalidArgumentException ( "Both arguments must be string." ) ; } $ this -> constraints [ ] = ( function ( Password $ str ) use ( $ regexp , $ message ) { if ( ! preg_match ( $ regexp , $ str ) ) { return $ message ; } else { return true ; } } ) ; return $ this ; }
Matches provided regular expression

@param string $regexp Regular expression that must be matched
@param string $message Error message on failure
@return $this
@throws \InvalidArgumentException
Matches provided regular expression