in reply to A regex on the same content fails and works, with conditions
Hm... Why you use binmode? I think you recieve text data so no need in binmode.
If you remove binmode option how the source string will looks in your file?