* On Sunday 2005-11-06 at 23:51:12 +0100, Andreas Schwab wrote:
> Charles Levert <[EMAIL PROTECTED]> writes:
> 
> > * On Sunday 2005-11-06 at 22:48:30 +0100, Andreas Schwab wrote:
> >> only in BREs which don't have alternation.
> >
> > Is that the justification?
> 
> I don't understand your question, but my point is that if you don't have
> alternation (and neither optional matches) the group referenced by a
> back-reference has always matched something fixed.

Well, no, as my example showed.  It contained
a bracket expression, [xy], and these are
not fixed, are allowed in BREs, and are the
equivalent of an alternation like (x|y).

So, consider '([[:alpha:]])z\1' and
it can become very cumbersome to write
'AzA|aza|BzB|...|ZzZ|zzz', and that's only
for the C locale.  Or consider '([^x])z\1'
with an UTF-8 locale.

   bash$ echo "☺z☺" | grep -E '([^x])z\1'; echo $?
   ☺z☺
   0
   bash$ echo "☺z☹" | grep -E '([^x])z\1'; echo $?
   1

Hence, my question was:  is that the
justification used by the POSIX committee when
they standardized on this behavior for EREs?
Because that justification seems to only rely
on something merely being possible (modulo the
maximum length of a command line), but still
being potentially very impractical.


Reply via email to