rdaniels_77 has asked for the wisdom of the Perl Monks concerning the following question:
I've not been successful in finding a lot of info using Perl RegEx for binary data. Think of a high level C structure:
typedef struct { int ID; int otherInt; unsigned char data[10]; } MYSTRUCT;
Let's say I have an array of MYSTRUCTs in a binary file. I want to look for a pattern, say 0xaa, 0xbb, 0xcc in each 'data' field. If I find it, return true.
For this example let's just say I have 1 structure, so the regex should skip 8 bytes (jump over the 2-32bit integers), then look for the 3 byte pattern 0xaa, 0xbb, 0xcc across the 10 bytes of the data field.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: RegEx on Binary data
by dave_the_m (Monsignor) on Oct 02, 2012 at 19:37 UTC | |
by rdaniels_77 (Initiate) on Oct 02, 2012 at 19:59 UTC | |
|
Re: RegEx on Binary data
by runrig (Abbot) on Oct 02, 2012 at 19:31 UTC |