Re: [pcre-dev] PCRE feature request - "backwards" search

Góra strony
Delete this message
Autor: Philip Hazel
Data:  
Dla: pcre-dev
CC: Mark Taylor
Temat: Re: [pcre-dev] PCRE feature request - "backwards" search
On Mon, 20 Sep 2010, I wrote:

> What it *actually* does is to convert <regex> into .*(<regex>) (note the
> parentheses) and then use what matches the parentheses as its "match".


I have realized that, with the current release of PCRE, an alternative
would be to convert it to .*\K<regex> thus preserving any capturing
numbers in the regex, and allowing you to use the normal start/end
offsets rather than those of parens #1. \K adjusts the starting point of
the match to where it is in the pattern. It was introduced in PCRE 7.2.

Regards,
Philip

--
Philip Hazel