Jump to content

Recommended Posts

I'm trying to extract some data from a hex file.  The data I want is prefixed by a series of hex characters then a country name a couple more hex characters then a user name.  I've attached a screen grab showing the data I'm extracting from.

 

There can be multiple sections in the file like this, with different countries (from a preset list) and user names.  And I'd like to extract all the countries and their associated user names.

 

I have a regular expression that I believe should work and does so in Editpad Pro however it doesn't in PHP.  This is my regex code

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\x0E(.*?)\x00\x0E/Us',$data,$matches);

 

 

[attachment deleted by admin]

Link to comment
https://forums.phpfreaks.com/topic/148399-extract-data-from-hex-file/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.