Re: [pcre-dev] Multi segment matching using pcre_dfa_exec

Top Page
Delete this message
Author: Philip Hazel
Date:  
To: Eldar Kleiner
CC: pcre-dev
Subject: Re: [pcre-dev] Multi segment matching using pcre_dfa_exec
On Sun, 18 Oct 2009, Eldar Kleiner wrote:

> True, but the caller will have to do that each time PCRE_PARTIAL is returned
> rather then only when there is a chance of losing matches.


Yes, I'm sorry, that is the case.

Suddenly, lying in bed this morning, I thought of another way one could
handle this. Instead of having one buffer, the application always keeps
two successive buffers, let's call them buffer A and buffer B.

You scan buffer A. Suppose it returns PCRE_PARTIAL at offset n. You then
scan buffer B with PCRE_DFA_RESTART. If it gives you a match you have
both parts of the matched string available. If it does not give you a
match, you go back to buffer A and scan again, starting at offset n+1.

Philip

--
Philip Hazel