public function format($measurement = null)
    {
        // Get the value
        $value = $this->getValue();

        // Do we have a negative value?
        $negative = $value < 0;

        // Switch to negative format
        $format = $negative ? 'negative' : 'format';

        // Get the measurement format
        $measurement = $measurement ?: $this->getMeasurement("{$this->to}.{$format}");

        // Value Regex
        $valRegex = '/([0-9].*|)[0-9]/';

        // Match decimal and thousand separators
        preg_match_all('/[,.!]/', $measurement, $separators);

        if ($thousand = array_get($separators, '0.0', null)) {
            if ($thousand == '!') {
                $thousand = '';
            }
        }

        $decimal = array_get($separators, '0.1', null);

        // Match format for decimals count
        preg_match($valRegex, $measurement, $valFormat);

        $valFormat = array_get($valFormat, 0, 0);

        // Count decimals length
        $decimals = $decimal ? strlen(substr(strrchr($valFormat, $decimal), 1)) : 0;

        // Strip negative sign
        if ($negative) {
            $value *= -1;
        }

        // Format the value
        $value = number_format($value, $decimals, $decimal, $thousand);

        // Return the formatted measurement
        return preg_replace($valRegex, $value, $measurement);
    }