protected function pregMatchArray($input, $rules, $flags = 0)
    {
        if (!is_array($rules)) {
            return false;
        }

        foreach ($rules as $rule => $value) {
            if (preg_match($rule, $input, $matches, $flags)) {
                return array_merge($matches, ['value' => $value]);
            }
        }

        return false;
    }