function Regex::__construct
Parameters
string|array<string,mixed>|null $pattern The regular expression to match:
string|null $htmlPattern The pattern to use in the HTML5 pattern attribute:
bool|null $match Whether to validate the value matches the configured pattern or not (defaults to false):
string[]|null $groups:
array<string,mixed> $options:
Overrides Constraint::__construct
2 calls to Regex::__construct()
- ExtensionNameConstraint::__construct in core/
lib/ Drupal/ Core/ Extension/ Plugin/ Validation/ Constraint/ ExtensionNameConstraint.php - Constructs an ExtensionNameConstraint object.
- ExtensionNameConstraint::__construct in core/
lib/ Drupal/ Core/ Extension/ Plugin/ Validation/ Constraint/ ExtensionNameConstraint.php - Constructs an ExtensionNameConstraint object.
1 method overrides Regex::__construct()
- ExtensionNameConstraint::__construct in core/
lib/ Drupal/ Core/ Extension/ Plugin/ Validation/ Constraint/ ExtensionNameConstraint.php - Constructs an ExtensionNameConstraint object.
File
-
vendor/
symfony/ validator/ Constraints/ Regex.php, line 45
Class
- Regex
- Validates that a value matches a regular expression.
Namespace
Symfony\Component\Validator\ConstraintsCode
public function __construct(string|array|null $pattern, ?string $message = null, ?string $htmlPattern = null, ?bool $match = null, ?callable $normalizer = null, ?array $groups = null, mixed $payload = null, array $options = []) {
if (\is_array($pattern)) {
$options = array_merge($pattern, $options);
}
elseif (null !== $pattern) {
$options['value'] = $pattern;
}
parent::__construct($options, $groups, $payload);
$this->message = $message ?? $this->message;
$this->htmlPattern = $htmlPattern ?? $this->htmlPattern;
$this->match = $match ?? $this->match;
$this->normalizer = $normalizer ?? $this->normalizer;
if (null !== $this->normalizer && !\is_callable($this->normalizer)) {
throw new InvalidArgumentException(\sprintf('The "normalizer" option must be a valid callable ("%s" given).', get_debug_type($this->normalizer)));
}
}