public function addFilter(string $expression): CopyDictionaryJob
    {
        // Check if the first and last char match - if not, we must encapsulate with '/'.
        if ($expression[0] !== substr($expression, -1)) {
            $expression = '/' . $expression . '/';
        }

        // Test if the regex is valid.
        try {
            preg_match($expression, '');
        } catch (\Throwable $error) {
            throw new \InvalidArgumentException(
                sprintf('Filter "%s" is not a valid regular expression - Error: %s', $expression, $error->getMessage()),
                0,
                $error
            );
        }

        $this->filters[] = $expression;

        return $this;
    }