Remove hex escape from string

regex, ruby

Solution

"\xfe\xff".unpack("H*").first
# => "feff"

Problem

I have the following hex as a string: `"\xfe\xff"`. I'd like to convert this to `"feff"`. How do I do this? The closest I got was `"\xfe\xff".inspect.gsub("\\x", "")`, which returns `"\"FEFF\""`.

Original source