Retina, 1313 10 bytes
T`da-f`fT`w`G-a9A9-0
This usesThere are three parts to the code, separated by backticks (`
): T
specifies transliterate mode and, which replaces each character in the second part with its helpful feature that does reverse rangescorresponding character in the third part.
w
is the same as traditional regex's \w
, soor f_0-a9A-Za-z
expands, which is expanded to fedcba_0123456789ABCDEFGH...
. More thorough explanation coming soon
The second part is expanded to GFEDCBA9876543210
, thanks to Retina's nifty ability to expand in reverse order. Put these on top of each other, and we get:
_0123456789ABCDEFGH...
GFEDCBA987654321000...
^^^^^^^^^^^^^^^^
Try the test suite online. Note that the last character, 0
, is repeated to fit the length of the longer string, but we only care about the hexadecimal characters, shown by carets.
Thanks to Martin Büttner for suggesting this approach.