src/Validator/Regex.php
public function isValid($value)
    {
        $this->resetMessages();

        $this->value = $value;

        if (!is_scalar($value) || is_bool($value)) {
            throw new \InvalidArgumentException('Unexpected type: '.gettype($value));
        }

        $value = (string) $value;

        $result = preg_match($this->pattern, $value);

        if ($result === false) {
            throw new \RuntimeException('Pattern "'.$this->pattern.'" gave an error for value "'.$value.'"');
        }

        if (!$result) {
            $this->addMessage();

            return false;
        }

        return true;
    }
public function isValid($value)
    {
        $this->resetMessages();

        $this->value = $value;

        if (!is_scalar($value) || is_bool($value)) {
            throw new \InvalidArgumentException('Unexpected type: '.gettype($value));
        }

        $value = (string) $value;

        $result = preg_match($this->pattern, $value);

        if ($result === false) {
            throw new \RuntimeException('Pattern "'.$this->pattern.'" gave an error for value "'.$value.'"');
        }

        if (!$result) {
            $this->addMessage();

            return false;
        }

        return true;
    }
{@inheritdoc}