in reply to Re: regular expression searching in binary files
in thread regular expression searching in binary files

Actually, I suspect that if indeed Unicode strings start at odd file (or buffer) positions, grandfathers method will fail to find them.

Interesting thought. However I checked it out with the sample code by inserting an extra byte before the 'Author' string and the match string was still found.

On reflection Perl doesn't know anything special about either the match string or the buffer being matched so the fact that there is meta information (the fact that it is actually utf-16) associated with the data is of no consequence.


DWIM is Perl's answer to Gödel
  • Comment on Re^2: regular expression searching in binary files

Replies are listed 'Best First'.
Re^3: regular expression searching in binary files
by dhlocker (Novice) on Nov 12, 2006 at 14:20 UTC
    Many thanks to all; I'll give those a try. I don't think I tried UCS-2, certainly not UCS-2LE.

    Donald.

Re^3: regular expression searching in binary files
by dhlocker (Novice) on Nov 13, 2006 at 13:25 UTC
    I am now looking at what I had finally written, and I've clarified my question in my own mind to ask "how does the R.E. engine handle the metacharacters in a non-text environment."

    Grandfather's example's \Q...\E led me to enlightment in the perlreref

    Many thi^Hanks
    Donald.