Re: [pcre-dev] match point reset bug?

Página superior
Eliminar este mensaje
Autor: Sheri
Fecha:  
A: pcre-dev
Asunto: Re: [pcre-dev] match point reset bug?
Philip Hazel wrote:
> On Tue, 18 Aug 2009, Sheri wrote:
>
>
>> Should it be possible to use \K in alternations?
>>
>> PCRE version 7.9 2009-04-11
>>
>> re> /abc\K|def\K/g
>> data> abcdefghi
>> 0:
>> data>
>>
>>
>> Seems there are two matches when done with perl (not personally tested).
>>
>
> I'll take a look (I'm slowly working through a number of issues, so
> might get there fairly soon). But \K is a Perl 5.10 feature, and I don't
> have 5.10 to test with.
>
> Philip
>
>


I didn't have it either. Just installed v5.10.0

The following prints abc-def-ghi

#!/usr/bin/perl

$d = "abcdefghi"    ;
$d =~ s/abc\K|def\K/-/g   ;


print $d, "\n";

Regards,
Sheri