[pcre-dev] Matching pattern inside binary file

Top Page
Delete this message
Author: Andrew Gavin
Date:  
To: pcre-dev
Subject: [pcre-dev] Matching pattern inside binary file
I am writing a utility in C to look for sensitive data (social
security numbers, credit cards, etc) at rest on Microsoft Windows
systems. I am opening each file on the system as binary ('fopen(
blah, "rb")') and reading it into a buffer with fread(). When I
attempt to use pcre_compile() (with PCRE_MULTILINE as an option) and
pcre_exec() on this buffer, it seems to give up after a few bytes
because it must encounter an embedded NULL character.

Is there an option to ignore embedded NULL characters and search the
entire file until end-of-file?

I am using the MinGW C compiler on Windows XP. I am using the
precompiled version from GnuWin32 that is linked from your site, which
I believe is PCRE 6.5.

Thanks for your help and for creating such a wonderful library.