Re: [pcre-dev] Partial matching in PCRE

Página superior
Eliminar este mensaje
Autor: ND
Fecha:  
A: pcre-dev
Asunto: Re: [pcre-dev] Partial matching in PCRE
>> Thanx for great work.
>> I read the changelog but dont find, that last bumpalong offset is
>> returned. Is there?
>
> Yes it is.
>
> 9.  The restrictions on what a pattern can contain when partial matching  
> is
>     requested for pcre_exec() have been removed. All patterns can now be
>     partially matched by this function. In addition, if there are at  
> least two
>                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>     slots in the offset vector, the offsets of the first-encountered  
> partial
>     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>     match are set in them when PCRE_ERROR_PARTIAL is returned.
>     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

>
> Philip
>


The first-encountered partial offset is not always equal to last bumpalong
offset.
In case of using '\K' the first-encountered partial offset is not useful,
but last bumpalong offset is.
For example
subject string: 'abc\Kxyz'
pattern: 'bcxy'
first-encountered partial offset: 4
last bumpalong offset: 2
IMHO, for multisegment matching purposes the last bumpalong offset is
needed.

Michael