Re: [pcre-dev] Searching a big file with PCRE

Página Principal
Apagar esta mensagem
Autor: Philip Hazel
Data:  
Para: Maël Hörz
CC: pcre-dev
Assunto: Re: [pcre-dev] Searching a big file with PCRE
On Sat, 29 Mar 2008, Maël Hörz wrote:

> I would like to search big files with PCRE, therefore it is not
> practical to load them into a buffer in one chunk. But as the
> subject-parameter of pcre_exec has to be a buffer and it doesn't seem to
> accept files or streams the file has to be read in chunks that are
> passed step by step to pcre_exec.


Have you considered using pcre_dfa_exec() instead? It doesn't support
all the features of pcre_exec(), but it is easier to use the partial
matching features. See the section called "MULTI-SEGMENT MATCHING WITH
pcre_dfa_exec()" in the pcrepartial man page.

Philip

--
Philip Hazel