Benno Schulenberg <[EMAIL PROTECTED]> writes: > Hmm... I'm not sure that backreferences are working correctly. > Shouldn't > > echo "cbaa" | egrep '(aa)cb|cb\1' > > give output?
Since (aa) does not match anything, what should \1 match? Note that a back-reference does not repeat the matching of the referenced subexpression, but only matches the exact string that was previously matched. > This does: > > echo "cbaa" | egrep '(aa)cb|cb(a)\2' Note that POSIX does not allow back-references in EREs, only in BREs which don't have alternation. Andreas. -- Andreas Schwab, SuSE Labs, [EMAIL PROTECTED] SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different."
