Controller_Validator_Basic::rule_regex PHP Метод

rule_regex() публичный Метод

Please give your rule a custom error message.
public rule_regex ( $a )
    public function rule_regex($a)
    {
        $opt = array();
        $rule = $this->pullRule();
        if ($rule[0] != '/') {
            $rule = '/^' . $rule . '*$/';
        }
        $opt['regexp'] = $rule;
        if (!filter_var($a, FILTER_VALIDATE_REGEXP, ['options' => $opt])) {
            return $this->fail('does not match the pattern');
        }
    }