[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Accepting [xyz---abc] - three minus signs to mean one
From: |
Bruno Haible |
Subject: |
Re: Accepting [xyz---abc] - three minus signs to mean one |
Date: |
Thu, 21 Apr 2022 13:04:07 +0200 |
Paul Eggert wrote on 2015-05-25:
> > the regexp is ambiguous
> > and does not conform to POSIX, which says the following about RE
> > bracket expressions: "To use a <hyphen> as the starting range point,
> > it shall either come first in the bracket expression or be specified
> > as a collating symbol; for example, "[][.-.]-0]", which matches either
> > a <right-square-bracket> or any character or collating element that
> > collates between <hyphen> and 0, inclusive."
> > <http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html#tag_09_03_05>
> >
> > In your correspondent's example, the hyphen is a starting range point
> > but is neither first in the bracket expression nor is specified as a
> > collating symbol, so the regexp doesn't conform to POSIX.
Is there some realistic possibility that the POSIX regex syntax might be
extended in the future, in such a way that [^0-9---] means something
different? If that happens, and if we opt now to assign a meaning to this
regex, we would have to choose between POSIX compliance and backward
compatibility — a bad situation.
Bruno