Re: [pcre-dev] Some words about assertion docs

Top Page
Delete this message
Author: ph10
Date:  
To: ND
CC: Pcre-dev
Subject: Re: [pcre-dev] Some words about assertion docs
On Sat, 22 Jun 2019, ND via Pcre-dev wrote:

> Your example is not working right (let's change 10 to 3 for simplicity):
>
> /\A.*\b(\w++)(?>.*?\b\1\b){2}/
> word1 word1 word2 word2 word2 word1
> 0: word1 word1 word2 word2 word2
> 1: word2
>
> We want to capture "word1" as most closer to the end of text. But "word2"
> captures.


I did not understand what you wanted. My regex finds the word whose
three appearances are closest to the end of the text, which is what I
thought you were looking for.

Philip

--
Philip Hazel