develooper Front page | perl.perl5.porters | Postings from November 2008

Re: PATCH [perl #59342] chr(0400) =~ /\400/ fails for >= 400

Thread Previous | Thread Next
From:
demerphq
Date:
November 4, 2008 09:03
Subject:
Re: PATCH [perl #59342] chr(0400) =~ /\400/ fails for >= 400
Message ID:
9b18b3110811040903m68f9e71aoe9ad3aa9b335fc21@mail.gmail.com
2008/10/25 karl williamson <public@khwilliamson.com>:
> So we have an existing bug.  sometimes \400 matches \400, and sometimes it
> matches \01\00, depending on what I would call spooky action at a distance.
>  (This means that \777 sometimes already matches \777 now.) I'm trying to
> get rid of these consistencies.

Ive been out of touch for a while so I'm not entirely up to speed on
what exactly you have in mind. But I think that you can not eliminate
the inconsistencies in octal/backref escapes. Especially some aspects
of spooky action at a distance, as that interacts with the number of
capture buffers in the LAST pattern matched.

So basically the docs should say, if they do not already,"it is
*strongly* recommended that you do NOT use octal in any form in a
regex" (except perhaps in a charclass definition).

And I would argue that in 5.12 we should make them warn, and then in
5.14 make them illegal or ONLY mean capture buffers.

Consider /\1/ means the first capture buffer of the previous match,
\17 means the _seventeenth_ capture buffer of the previous match IFF
the previous match contains more 17 or more capture buffers, otherwise
it means \x{F}.

In short: resolving the inconsistencies in octal notation in regex
notation would appear to be impossible.

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