in reply to Command Line Regex

You were really close -- change "char" to "chr", add "e" at the end, and drop the dash between 9 and A:
perl -i.bak -pe 's/\%([0-7][0-9A-F])/chr(hex($1))/ge'
Bear in mind that values %00-%1F and %7F won't be things that you can "read" very well -- in fact, if you encounter %0D without an adjacent %0A, the resulting display could be very misleading. You might want to limit the regex to:
s/\%([2-6][0-9A-F]|7[0-9A-E])/chr(hex($1))/ge

Replies are listed 'Best First'.
Re^2: Command Line Regex
by parv (Parson) on Apr 07, 2006 at 05:01 UTC

    Missed the the dash in "0-9-A-F"; thanks for catching.