Nice... but, hex escapes and octal escapes aren't fixed
width. "\xA" is a newline, and octal escapes (which need
a leading 0 that you have also forgotten) can
have less than 3 octets as well.
And be aware of Unicode. There will be lots more escape
sequences with Unicode.