in reply to search binary file

This node looks relevant: Using regexp with binary data

I found this by Super Searching for "binary regex".

Replies are listed 'Best First'.
Re^2: search binary file
by perlfan99 (Sexton) on Jul 11, 2008 at 21:16 UTC
    data is like:
    "my data^A77789^B^Bmore data"; i tried to match it using "/(data^A)(\d+)^B/", i would expect:
    $1 = data^A
    $2 = 77789
    however, it didn't work. (note: ^A is one character)
      By ^A do you mean Control-A (i.e. chr(1)?

      If so, use this:

      if ($input =~ m/(data\x1)(\d+)\x2/) { print "1 = $1, length = ", length($1), "\n"; print "2 = $2\n"; }
        yes ^A means ctrl-A, thanks superdoc, your tip works