develooper Front page | perl.perl5.porters | Postings from June 2013

Re: Regex \8 and \9 after literals no longer work

Thread Previous | Thread Next
From:
demerphq
Date:
June 25, 2013 18:26
Subject:
Re: Regex \8 and \9 after literals no longer work
Message ID:
CANgJU+Vh_=pweS8gFuqZFDJXRPey-DLVR_z-Wk8LZHVYp6AU0w@mail.gmail.com
On 25 June 2013 16:55, Michael Schroeder <mls@suse.de> wrote:
>
> Hi Porters,
>
> commit #726ee55d breaks matching of \8 and \9 if they come after a
> literal:
>
>     use re 'debug';
>     my $a = '(((((((((x)))))))))foo\9';
>     my $b = 'xfoox';
>     $b =~ /$a/;
>
> Output:
>
> Final program:
>    1: OPEN1 (3)
>    3:   OPEN2 (5)
>    5:     OPEN3 (7)
>    7:       OPEN4 (9)
>    9:         OPEN5 (11)
>   11:           OPEN6 (13)
>   13:             OPEN7 (15)
>   15:               OPEN8 (17)
>   17:                 OPEN9 (19)
>   19:                   EXACT <x> (21)
>   21:                 CLOSE9 (23)
>   23:               CLOSE8 (25)
>   25:             CLOSE7 (27)
>   27:           CLOSE6 (29)
>   29:         CLOSE5 (31)
>   31:       CLOSE4 (33)
>   33:     CLOSE3 (35)
>   35:   CLOSE2 (37)
>   37: CLOSE1 (39)
>   39: EXACT <foo9> (41)
>   41: END (0)
>
> Note the "foo9" exact match. A workaround is to use \g9, of course,
> but the perlre man page says: "C<\1> through C<\9> are always
> interpreted as backreferences".
>
> (The change breaks the latex2html package, btw.)

Thanks for the report. I agree this is a bug. I am looking into a fix.

Yves

--
perl -Mre=debug -e "/just|another|perl|hacker/"

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About