URL:
<http://savannah.gnu.org/bugs/?21199>
Summary: odd output for some patterns combining
backreference, alternation, and repetition
Project: grep
Submitted by: lexlamey
Submitted on: Sunday 09/30/2007 at 20:03
Category: None
Severity: 3 - Normal
Item Group: None
Status: None
Privacy: Public
Assigned to: None
Open/Closed: Open
Discussion Lock: Any
_______________________________________________________
Details:
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}'
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?21199>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/