--- In [email protected], "entropyreduction" 
<alancampbelllists+ya...@...> wrote:
>
> --- In [email protected], "Sheri" <sherip99@> wrote:
> >
> > I found a problem. Unlike earlier PCRE releases, PCRE 8.00
> > updates its vector when PCRE_ERROR_PARTIAL is returned. 
> 
> So, what you're saying that in previous versions vector was never
> set with offsets if executing a PCRE_ERROR_PARTIAL, now it is,
> and I should therefore should in presence of "offsets" option,
> pick up those offsets and shove em into a vec, if provided.

I think if a user vector handle is provided, something should now go into it 
even if there is no "offsets" option. Ditto if a variable name is provided. 
Currently nothing is getting set, but in the past PCRE didn't provide anything 
in its vector for partial matches (at least with pcre_exec).

Normally our regex.pcrematch returns the startoffset of a match. But for 
partial matches, it returns -2. I don't think that should change (although 
there is also regex_status for partial match).

> They'll never be more than two numbers in that vector, yeah?

I believe that is true. I think you need to run exec with a string that fully 
contains a match in order to get offsets for any substrings.

Regards,
Sheri

> 
> > When the option "offsets" is included with partial_hard or
> > partial_soft, and a partial match status is obtained, there are
> > no entries in our vector. 

> > local hVec
> > if (vec.exists(hVec))
> >   vec.destroy(hVec)
> > hVec=vec.create(2)
> > local ret=regex.pcrematch(?"abcdef|a.", "ab", ;;+
> > "partial_hard offsets", hVec)
> > win.debug("99: (test partial_hard) ret", ret, "status", regex_status)
> > if (hVec.length > 0) do
> >   win.debug(hVec[0] ++" at offset "++hVec[1])
> > else
> >   win.debug("99: hVec is empty")
> > endif
> > quit
> > 
> > Regards,
> > Sheri
> >
>


Reply via email to