Author: ND Date: To: Pcre-dev Subject: Re: [pcre-dev] Some words about assertion docs
On 2019-06-22 08:56, ph10 wrote: > On Fri, 21 Jun 2019, ND via Pcre-dev wrote:
>> Imagine that we have a text. There are some words in this text that
> occurs at
> > least 10 times. We want to find from they a word that is most closer
> to the
> > end of text.
> >> If lookahead assertion is non-possessive then we can use this pattern:
> >> \A(?=.*\b(\w++))(?>.*?\b\1\b){10}
> >> What pattern can solve this task with current PCRE2?
>/\A.*\b(\w++)(?>.*?\b\1\b){9}/
>You do not need a lookahead to do this.
>
Your example is not working right (let's change 10 to 3 for simplicity):