Extract data from hex file
Posted: Sun Mar 08, 2009 3:14 pm
I am trying to use the following to extract data from a hex file.
The data I want to extract has a series of hex characters followed by either austria, britain or france (with each character separated by the hex 00) then another couple of hex characters then a user name. The regular expression above works in editpad pro but not in PHP and I don't see why. I've tried using the u modifier but no change.
This link shows the sample data I am working with.
I am by no means a regular expression expert but can usually muddle my way through. This time however I just don't understand where I'm going wrong.
Code: Select all
preg_match_all('/\x00\x0E[\x07|\x06]\x00(a\x00u\x00s\x00t\x00r\x00i\x00a|b\x00r\x00i\x00t\x00a\x00i\x00n|f\x00r\x00a\x00n\x00c\x00e)\x00(.*?)\x00\x0E/s',$data,$matches);This link shows the sample data I am working with.
I am by no means a regular expression expert but can usually muddle my way through. This time however I just don't understand where I'm going wrong.