public function format($mask, callable $matchHandler)
    {
        try {
            // Run a regular expression to match the mask
            return preg_replace_callback('/%(.*?)%/i', function ($matches) use ($matchHandler) {
                // Return the result returned from the matchHandler
                return $this->getResult($matches[1], $matchHandler) ?: '';
            }, $mask);
        } catch (\Exception $e) {
            // Log any failures
            $this->logger->debug(
                'Failed to format express mask "{mask}": {message}',
                ['mask' => $mask, 'message' => $e->getMessage(), 'exception' => $e]
            );
        }
    }