Good, finally some code. :)
The problem lies in the first part of your regexp:
m[ (?<= ^ .{4} )*? ... ]x
The (?<= ... ) construct is an assertion, so matching it "zero or more times" is the same as matching it zero or one times, and in all these cases it is matching zero times: that is, the text doesn't follow (beginning of string followed by 4 characters (bytes)).
I'm not sure why you turned off warnings within the block, but the "matches null string many times" warning was a (not very helpful) indication of this.
In any case, you cannot use variable-width matches inside a lookbehind, so if you want to stick with this approach, I would suggest something like this:
if ($bindata =~ m[ ^ (?: .{4} )*? \Q$bin\E ]x) { print "regex found $n at ", pos( $bindata ) - length( $bin ); }
Hugo
In reply to Re^7: Warning: Unicode bytes!
by hv
in thread Warning: Unicode bytes!
by BrowserUk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |