Autor: ph10 Data: Dla: Zoltán Herczeg CC: Pcre-dev, ND Temat: Re: [pcre-dev] Some words about assertion docs
On Thu, 20 Jun 2019, Zoltán Herczeg wrote:
> > (?=x|y) looks much more ergonomical than (?:(?=x)|(?=y))
>
> They behave the same way, so pick whatever you prefer.
(?:(?=X)|(?=Y))Z means "if X matches, try to match Z; if that fails, if
Y matches try to match Z". In the simple case the second match of Z will
be the same as the first, so will always fail. However, if X and Y are
complex and contain capturing parentheses, I suppose it is possible to
construct Z using back references in such a way that it fails after X
matches but succeeds after Y matches.
But who would want to constuct such a complicated thing?