Hi,
I think grep (2.5.1) is misbehaving on me. Here are twelve examples,
wherein I apply six patterns (differing only in the repetition argument)
to two inputs (differing only in their fifth character). Five of the
outputs (marked '!') seem to be wrong to me. But I'm quite new to grep
so maybe I've misunderstood something.
$ echo 88-88 | egrep -o '([0-9])([0-9])-(\1|\2){1}'
88-8
$ echo 88-88 | egrep -o '([0-9])([0-9])-(\1|\2){2}'
88-88
$ echo 88-88 | egrep -o '([0-9])([0-9])-(\1|\2){3}'
88-88
!
$ echo 88-88 | egrep -o '([0-9])([0-9])-(\1|\2){4}'
88-8
!!
$ echo 88-88 | egrep -o '([0-9])([0-9])-(\1|\2){5}'
88-88
!
$ echo 88-88 | egrep -o '([0-9])([0-9])-(\1|\2){6}'
88-88
!
$ echo 88-81 | egrep -o '([0-9])([0-9])-(\1|\2){1}'
88-8
$ echo 88-81 | egrep -o '([0-9])([0-9])-(\1|\2){2}'
88-8
!
$ echo 88-81 | egrep -o '([0-9])([0-9])-(\1|\2){3}'
$ echo 88-81 | egrep -o '([0-9])([0-9])-(\1|\2){4}'
$ echo 88-81 | egrep -o '([0-9])([0-9])-(\1|\2){5}'
$ echo 88-81 | egrep -o '([0-9])([0-9])-(\1|\2){6}'
If this isn't a bug, but a mistake on my part, an explanation would be
appreciated.
Thanks,
-Alex