['', 'The regular expression to use for validation, used as given', 'string', true], 'message' => [null, 'Translation key or message when regular expression results in a no match', 'string'], ]; /** * Checks if the given value matches the specified regular expression. * * @throws InvalidValidationOptionsException */ public function isValid(mixed $value): void { $result = preg_match($this->options['regularExpression'], $value); if ($result === 0) { $this->addError( $this->translateErrorMessage($this->message), 1221565130 ); } if ($result === false) { throw new InvalidValidationOptionsException('regularExpression "' . $this->options['regularExpression'] . '" in RegularExpressionValidator contained an error.', 1298273089); } } }