public function __construct($minLength = 0, $maxLength = null, $tags = '') { if (func_num_args() >= 2) { $this->minLength = $minLength; $this->maxLength = $maxLength; } else { if (func_num_args() == 1) { $this->maxLength = $this->minLength = $minLength; } else { if (func_num_args() == 0) { $this->minLength = 0; $this->maxLength = null; } } } parent::__construct(sprintf('^(.{%s,%s})$', $this->minLength, $this->maxLength), $tags); }
public function __construct($min = null, $max = null, $type = 'number') { if (func_num_args() >= 2) { $this->min = $min; $this->max = $max; } else { if (func_num_args() == 1) { $this->max = $this->min = $min; } else { if (func_num_args() == 0) { $this->min = null; $this->max = null; } } } switch ($type) { case 'unsigned float': case 'unsigned double': $regex = '^[0]*(?P<int>[1-9][0-9]*|0+)\\.((?P<decimal>[0-9]*))?$'; $this->realType = $type; $type = 'double'; break; case 'unsigned integer': $regex = '^[0]*(?P<int>[1-9][0-9]*|0+)$'; $this->realType = $type; $type = 'integer'; break; case 'float': case 'double': $regex = '^(?P<sign>\\-?)[0]*(?P<int>[1-9][0-9]*|0+)\\.((?P<decimal>[0-9]*))?$'; $this->realType = $type; break; case 'integer': $regex = '^(?P<sign>\\-?)[0]*(?P<int>[1-9][0-9]*|0+)$'; $this->realType = 'integer'; break; case 'number': default: $regex = '^(?P<sign>\\-?)[0]*(?P<int>[1-9][0-9]*|0+)(\\.(?P<decimal>[0-9]*))?$'; $this->realType = 'number'; $type = 'float'; } $this->type = $type; parent::__construct($regex); }
public function __construct($tags = '') { parent::__construct('^((.*?@.*?(\\.[a-z]+)+)?)$', $tags); }
public function __construct() { parent::__construct('/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/'); }
public function __construct() { parent::__construct('/^[_a-zA-Z0-9\\-]+(\\.[_a-zA-Z0-9\\-]+)*@[a-zA-Z0-9\\-]+(\\.[a-zA-Z0-9\\-]+)*(\\.[a-zA-Z]{2,})$/'); }
public function __construct() { parent::__construct('/^[a-zäàáâöôüûñéè0-9!\\#\\$\\%\\&\'\\*\\+\\/\\=\\?\\^_\\`\\{\\|\\}\\~-]+(?:\\.[a-zäàáâöôüûñéè0-9!\\#\\$\\%\\&\'\\*\\+\\/\\=\\?\\^_\\`\\{\\|\\}\\~-]+)*@(?:[a-zäàáâöôüûñéè0-9](?:[a-zäàáâöôüûñéè0-9-]*[a-zäàáâöôüûñéè0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/'); }
/** * Construct a new URL validator instance * @param array $options options for this instance * @return null */ public function __construct(array $options = array()) { $this->initRegularExpressions(); $options[RegexValidator::OPTION_REGEX] = '/^' . $this->regexUrl . '$/'; parent::__construct($options); $this->code = self::CODE; $this->message = self::MESSAGE; }
public function __construct() { parent::__construct(self::PATTERN); }