public function term($value, string $pattern): array
    {
        $result = \preg_match("/$pattern/", $value);

        if ($result === false || $result === 0) {
            $errorCode = \preg_last_error();

            throw new \Exception("The pattern {$pattern} is not valid for value {$value}. Failed with error code {$errorCode}.");
        }

        return [
            'data' => [
                'generate' => $value,
                'matcher'  => [
                    'json_class' => 'Regexp',
                    'o'          => 0,
                    's'          => $pattern,
                ],
            ],
            'json_class' => 'Pact::Term',
        ];
    }