Well there is a problem with a $bregex... PCRE doesn't support using regex on binary data. PCRE uses character strings for its data. A character string can not contain the character 0 (NUL) but binary data can.