in reply to hex in regexp

if you want to learn, look at the various regex suggestions and play around with them. if you want to do it right, use a module like URI::Escape (which also can escape utf8 strings, for example)