On Thu, Jun 01, 2006 at 05:35:58PM -0600, Doug McNutt wrote:
> perl supports a hex($astring) function that will convert a string of hex
> characters to decimal. If you can reliably extract such a string using a
> regular expression with capture parentheses it might work. You could
> probably call hex($1) from within a substitution expression using a
> modifier that I would have to look up. q comes to mind.

It's /e for eval.  q is not currently a regex modifier.

You'd want something like this:

#!/usr/local/bin/perl -pi

s/(...)([0-9A-F]+)(...)/$1 . hex($2) . $3/ige;

__END__

(...) would be whatever you need to match around the hex numbers.

Ronald

-- 
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <[EMAIL PROTECTED]>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to:  <[EMAIL PROTECTED]>

Reply via email to