concrete/src/Validator/PasswordValidatorServiceProvider.php
protected function wrappedRegexValidator($regex, $requirementString)
    {
        $regexValidator = $this->regexValidator($regex, $requirementString);
        $validator = $this->app->make(ClosureValidator::class, [
            function (ClosureValidator $validator, $string, ArrayAccess $error = null) use ($regexValidator) {
                try {
                    $regexValidator->isValid($string, $error);
                } catch (\RuntimeException $e) {
                    if ($error) {
                        $error[] = $regexValidator::E_DOES_NOT_MATCH;
                    }

                    return false;
                }
            },
            function () use ($regexValidator, $requirementString) {
                return [
                    $regexValidator::E_DOES_NOT_MATCH => $requirementString
                ];
            }
        ]);

        return $validator;

    }
protected function wrappedRegexValidator($regex, $requirementString)
    {
        $regexValidator = $this->regexValidator($regex, $requirementString);
        $validator = $this->app->make(ClosureValidator::class, [
            function (ClosureValidator $validator, $string, ArrayAccess $error = null) use ($regexValidator) {
                try {
                    $regexValidator->isValid($string, $error);
                } catch (\RuntimeException $e) {
                    if ($error) {
                        $error[] = $regexValidator::E_DOES_NOT_MATCH;
                    }

                    return false;
                }
            },
            function () use ($regexValidator, $requirementString) {
                return [
                    $regexValidator::E_DOES_NOT_MATCH => $requirementString
                ];
            }
        ]);

        return $validator;

    }
protected function wrappedRegexValidator ( $ regex , $ requirementString ) { $ regexValidator = $ this -> regexValidator ( $ regex , $ requirementString ) ; $ validator = $ this -> app -> make ( ClosureValidator :: class , [ function ( ClosureValidator $ validator , $ string , ArrayAccess $ error = null ) use ( $ regexValidator ) { try { $ regexValidator -> isValid ( $ string , $ error ) ; } catch ( \ RuntimeException $ e ) { if ( $ error ) { $ error [ ] = $ regexValidator :: E_DOES_NOT_MATCH ; } return false ; } } , function ( ) use ( $ regexValidator , $ requirementString ) { return [ $ regexValidator :: E_DOES_NOT_MATCH => $ requirementString ] ; } ] ) ; return $ validator ; }
Create a closure validator that wraps a regex validator and handles all errors
If the given regex is invalid, we will deny all passwords!

@param $regex
@param $requirementString

@return \Concrete\Core\Validator\ClosureValidator|mixed
Create a closure validator that wraps a regex validator and handles all errors If the given regex is invalid we will deny all passwords!