func restoreHexEscapes()

in main.go [196:211]


func restoreHexEscapes(s1 string) (string, error) {
	if s1 == `\n` {
		return "\n", nil
	}

	re := regexp.MustCompile(`\\x([0-9A-Fa-f]{2})`)

	return re.ReplaceAllStringFunc(s1, func(match string) string {
		hexValue := match[2:] // Remove the \x prefix
		decValue, err := strconv.ParseInt(hexValue, 16, 0)
		if err != nil {
			return match
		}
		return string(rune(decValue))
	}), nil
}