------- You are receiving this mail because: -------
You are on the CC list for the bug.
http://bugs.exim.org/show_bug.cgi?id=617
--- Comment #1 from Philip Hazel <ph10@???> 2007-10-17 09:11:44 ---
On Tue, 16 Oct 2007, Felipe Nascimento S. Pena wrote:
> re> /(a(?1))/
> data> aa
> No match
>
> re> /(a(?-1))/
> data> aa
> No match
>
> Shouldn't it show error message as "Failed: reference to non-existent
> subpattern"?
No. It's a recursive subroutine call. It's like this example in the
documentation:
( \( ( (?>[^()]+) | (?1) )* \) )
> Who's referenced by (?-1)?
The most recently opened parentheses. This is documented:
In a larger pattern, keeping track of parenthesis numbers can be
tricky. This is made easier by the use of relative references. (A Perl
5.10 feature.) Instead of (?1) in the pattern above you can write
(?-2) to refer to the second most recently opened parentheses preceding
the recursion. In other words, a negative number counts capturing
parentheses leftwards from the point at which it is encountered.
> -----------------------------------------------------
>
> re> /(?(DEFINE)(?<a>\d+)(?<b>[a-z](?-1)))(?&)/
> data> 1a1
> 0: 1
> 1: <unset>
>
> (?&) references first named grouping? This is documented?
This might be a bug. I'll look into it in more detail when I get the
time.
> -----------------------------------------------------
>
> re> /(?){0}/
> Failed: nothing to repeat at offset 5
>
> Nothing to repeat not even nonce?
That also looks like a bug.
> ------------------------------------------------------
>
> re> /(?:?)/
> Failed: nothing to repeat at offset 3
That is correct. The second ? does not follow something that can be
repeated.
> re> /(?<a>?)/
> Failed: nothing to repeat at offset 5
Same.
> But /(?)/ is accepted.
That is probably a bug. It should only allow recognized characters after
(? I think.
Thank you for the report. I will be looking at PCRE in a few weeks'
time, and I'll check up on these issues then.
Regards,
Philip
--
Configure bugmail:
http://bugs.exim.org/userprefs.cgi?tab=email