Re: [pcre-dev] [Bug 1429] New: PCRE 8.34

Page principale
Supprimer ce message
Auteur: Jean-Christophe Deschamps
Date:  
À: pcre-dev
Sujet: Re: [pcre-dev] [Bug 1429] New: PCRE 8.34

At 10:59 31/12/2013, you wrote:

     > With pcre 8.34 :
     >   re> /[^._=-\w]+/
     > Failed: invalid range in character class at offset 7
     If Perl is run with the -w (warn) option, this pattern gives:
       False [] range "=-\w" in regex; marked by <-- HERE in m/[^._=-\w
     <--
       HERE ]+/ at (eval 1) line 1, <INFILE> line 1.


     It does, however, go on to match something; I think it treats the
     hyphen
     as a literal.
     PCRE does not have a warning mode for compiles; it either succeeds
     or
     gives an error. I thought that the previous behaviour of silently
     turning the hyphen into a literal was a bad idea, so I instituted
     the
     error.


Maybe this is not related to the issue I just encountered, but it
looks close. I couldn't find a reference to a change in handling \g-n
in classes in the revision log.
Previous versions (like 3.8.12 which is the only previous one I'm sure
worked) allowed negative backreferences inside groups, e.g. \g-1 or
\g{-1} but 3.8.33 errors on it.
Some such situations can be handled otherwise but I wonder whether
raising an error on [^\g-1] is the definitive behavior or whether the
old behavior can be restored in some future revision.
Season's greatings.

--
[1]jcd@???

References

1. mailto:jcd@q-e-d.org